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 Nov 18, 2024
1 parent 5fba7d9 commit de2d967
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 de2d967

Please sign in to comment.