Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Enable EPM failing suite #153928

Merged
merged 5 commits into from
Mar 30, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GetPackagePoliciesResponse,
GetStatsResponse,
GetSettingsResponse,
GetVerificationKeyIdResponse,
} from '../../../../../../../common/types/rest_spec';
import type {
DetailViewPanelName,
Expand All @@ -40,7 +41,7 @@ ExperimentalFeaturesService.init({});
import { Detail } from '.';

// FLAKY: https://github.com/elastic/kibana/issues/150607
describe.skip('when on integration detail', () => {
describe('when on integration detail', () => {
const pkgkey = 'nginx-0.3.7';
const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey })[1];
let testRenderer: TestRenderer;
Expand Down Expand Up @@ -138,6 +139,16 @@ describe.skip('when on integration detail', () => {
await render();
});

it('should NOT display agent policy usage count', async () => {
await mockedApi.waitForApi();
expect(renderResult.queryByTestId('agentPolicyCount')).toBeNull();
});

it('should NOT display the Policies tab', async () => {
await mockedApi.waitForApi();
expect(renderResult.queryByTestId('tab-policies')).toBeNull();
});

it('should display version text and no callout if prerelease setting disabled', async () => {
await mockedApi.waitForApi();
expect((renderResult.queryByTestId('versionText') as any)?.textContent).toEqual('1.0.0');
Expand Down Expand Up @@ -324,6 +335,7 @@ interface EpmPackageDetailsResponseProvidersMock {
agentPolicyList: jest.MockedFunction<() => GetAgentPoliciesResponse>;
appCheckPermissions: jest.MockedFunction<() => CheckPermissionsResponse>;
getSettings: jest.MockedFunction<() => GetSettingsResponse>;
getVerificationKeyId: jest.MockedFunction<() => GetVerificationKeyIdResponse>;
}

const mockApiCalls = (
Expand Down Expand Up @@ -805,6 +817,8 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos

const getSettingsResponse = { item: { prerelease_integrations_enabled: true } };

const getVerificationKeyIdResponse = { id: 'test-verification-key' };

const mockedApiInterface: MockedApi<EpmPackageDetailsResponseProvidersMock> = {
waitForApi() {
return new Promise((resolve) => {
Expand All @@ -824,6 +838,7 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos
agentPolicyList: jest.fn().mockReturnValue(agentPoliciesResponse),
appCheckPermissions: jest.fn().mockReturnValue(appCheckPermissionsResponse),
getSettings: jest.fn().mockReturnValue(getSettingsResponse),
getVerificationKeyId: jest.fn().mockReturnValue(getVerificationKeyIdResponse),
},
};

Expand Down Expand Up @@ -880,6 +895,9 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos
if (path === '/api/fleet/settings') {
return mockedApiInterface.responseProvider.getSettings();
}
if (path === '/api/fleet/epm/verification_key_id') {
return mockedApiInterface.responseProvider.getVerificationKeyId();
}

const err = new Error(`API [GET ${path}] is not MOCKED!`);
// eslint-disable-next-line no-console
Expand Down