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

Fix deployment agnostic integrations test #199977

Merged
Merged
Changes from 3 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 @@ -58,12 +58,6 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
withInternalHeaders: true,
}
);

preExistingIntegrations = (
await callApiAs({
roleScopedSupertestWithCookieCredentials: supertestAdminWithCookieCredentials,
})
).integrations.map((integration: Integration) => integration.name);
});

after(async () => {
Expand All @@ -72,6 +66,12 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {

describe('gets the installed integrations', () => {
before(async () => {
preExistingIntegrations = (
await callApiAs({
roleScopedSupertestWithCookieCredentials: supertestAdminWithCookieCredentials,
})
).integrations.map((integration: Integration) => integration.name);

await Promise.all(
integrationPackages.map((pkg) =>
packageApi.installPackage({
Expand All @@ -87,9 +87,9 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
roleScopedSupertestWithCookieCredentials: supertestAdminWithCookieCredentials,
});

expect(body.integrations.map((integration: Integration) => integration.name).sort()).to.eql(
preExistingIntegrations.concat(['synthetics', 'system']).sort()
);
expect(
new Set(body.integrations.map((integration: Integration) => integration.name).sort())
).to.eql(new Set(preExistingIntegrations.concat(['synthetics', 'system']).sort()));

expect(
body.integrations.find((integration: Integration) => integration.name === 'synthetics')
Expand All @@ -113,6 +113,12 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {

describe('gets the custom installed integrations', () => {
before(async () => {
preExistingIntegrations = (
await callApiAs({
roleScopedSupertestWithCookieCredentials: supertestAdminWithCookieCredentials,
})
).integrations.map((integration: Integration) => integration.name);

await Promise.all(
customIntegrations.map((customIntegration: CustomIntegration) =>
packageApi.installCustomIntegration({ roleAuthc: adminRoleAuthc, customIntegration })
Expand All @@ -125,9 +131,9 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
roleScopedSupertestWithCookieCredentials: supertestAdminWithCookieCredentials,
});

expect(body.integrations.map((integration: Integration) => integration.name).sort()).to.eql(
preExistingIntegrations.concat('my.custom.integration').sort()
);
expect(
new Set(body.integrations.map((integration: Integration) => integration.name).sort())
).to.eql(new Set(preExistingIntegrations.concat('my.custom.integration').sort()));

expect(
Object.entries(
Expand Down