Skip to content

Commit

Permalink
Fix deployment agnostic integrations test
Browse files Browse the repository at this point in the history
  • Loading branch information
fake-haris authored and CAWilson94 committed Dec 12, 2024
1 parent 4d451f0 commit 184c392
Showing 1 changed file with 18 additions and 12 deletions.
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))
).to.eql(new Set(preExistingIntegrations.concat(['synthetics', 'system'])));

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))
).to.eql(new Set(preExistingIntegrations.concat('my.custom.integration')));

expect(
Object.entries(
Expand Down

0 comments on commit 184c392

Please sign in to comment.