Skip to content

Commit

Permalink
Rename supertest
Browse files Browse the repository at this point in the history
  • Loading branch information
crespocarlos committed Nov 11, 2024
1 parent 18e8def commit 5d475f1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

describe('error count threshold alert', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;
let supertestWithRoleScope: SupertestWithRoleScopeType;
let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType;
let roleAuthc: RoleCredentials;

const javaErrorMessage = 'a java error';
Expand All @@ -52,12 +52,15 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
};

before(async () => {
supertestWithRoleScope = await roleScopedSupertest.getSupertestWithRoleScope('viewer', {
withInternalHeaders: true,
useCookieHeader: true,
});
supertestViewerWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope(
'viewer',
{
withInternalHeaders: true,
useCookieHeader: true,
}
);

roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('admin');
roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('editor');

const opbeansJava = apm
.service({ name: 'opbeans-java', environment: 'production', agentName: 'java' })
Expand Down Expand Up @@ -113,7 +116,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

after(async () => {
await apmSynthtraceEsClient.clean();
await supertestWithRoleScope.destroy();
await supertestViewerWithCookieCredentials.destroy();
await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

describe('transaction duration alert', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;
let supertest: SupertestWithRoleScopeType;
let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType;
let roleAuthc: RoleCredentials;

before(async () => {
supertest = await roleScopedSupertest.getSupertestWithRoleScope('viewer', {
withInternalHeaders: true,
useCookieHeader: true,
});
supertestViewerWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope(
'viewer',
{
withInternalHeaders: true,
useCookieHeader: true,
}
);

roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('admin');

Expand Down Expand Up @@ -83,7 +86,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

after(async () => {
await apmSynthtraceEsClient.clean();
await supertest.destroy();
await supertestViewerWithCookieCredentials.destroy();
await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

describe('transaction error rate alert', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;
let supertest: SupertestWithRoleScopeType;
let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType;
let roleAuthc: RoleCredentials;

before(async () => {
supertest = await roleScopedSupertest.getSupertestWithRoleScope('viewer', {
withInternalHeaders: true,
useCookieHeader: true,
});
supertestViewerWithCookieCredentials = await roleScopedSupertest.getSupertestWithRoleScope(
'viewer',
{
withInternalHeaders: true,
useCookieHeader: true,
}
);

roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('admin');

Expand Down Expand Up @@ -81,7 +84,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

after(async () => {
await apmSynthtraceEsClient.clean();
await supertest.destroy();
await supertestViewerWithCookieCredentials.destroy();
await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
});

Expand Down

0 comments on commit 5d475f1

Please sign in to comment.