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

[8.x] [APM] Attempt to fix flaky test in service_group_count.spec.ts (#204543) #205691

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all 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 @@ -27,6 +27,16 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
const start = Date.now() - 24 * 60 * 60 * 1000;
const end = Date.now();

const cleanUpAlerts = ({ roleAuthc, ruleId }: { roleAuthc: RoleCredentials; ruleId: string }) => {
return alertingApi.cleanUpAlerts({
roleAuthc,
ruleId,
alertIndexName: APM_ALERTS_INDEX,
connectorIndexName: APM_ACTION_VARIABLE_INDEX,
consumer: 'apm',
});
};

describe('Service group counts', () => {
let synthbeansServiceGroupId: string;
let opbeansServiceGroupId: string;
Expand Down Expand Up @@ -73,6 +83,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon

before(async () => {
roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('admin');
await cleanUpAlerts({ roleAuthc, ruleId });
const createdRule = await alertingApi.createRule({
name: 'Latency threshold | synth-go',
params: {
Expand All @@ -94,13 +105,7 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
});

after(async () => {
await alertingApi.cleanUpAlerts({
roleAuthc,
ruleId,
alertIndexName: APM_ALERTS_INDEX,
connectorIndexName: APM_ACTION_VARIABLE_INDEX,
consumer: 'apm',
});
await cleanUpAlerts({ roleAuthc, ruleId });
await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
});

Expand Down
Loading