From 69709dfec6a63d3ee279d5bac374620a2875dc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20C=C3=B4t=C3=A9?= Date: Thu, 31 Oct 2024 14:38:48 -0400 Subject: [PATCH] Wait for backfill SOs to be deleted before running the invalidate API key task (#198422) Resolves https://github.com/elastic/kibana/issues/198168 Flaky test runners: - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7309 - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7314 --- .../group1/tests/alerting/backfill/api_key.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group1/tests/alerting/backfill/api_key.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group1/tests/alerting/backfill/api_key.ts index 46a92d176bab0..cf818de0e4fab 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group1/tests/alerting/backfill/api_key.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group1/tests/alerting/backfill/api_key.ts @@ -252,6 +252,17 @@ export default function apiKeyBackfillTests({ getService }: FtrProviderContext) expect(e?.event?.outcome).to.eql('success'); } + // wait for all the ad hoc run SO to be deleted + await retry.try(async () => { + try { + // throws when not found + await getAdHocRunSO(backfillId); + throw new Error('should have thrown'); + } catch (e) { + expect(e.message).not.to.eql('should have thrown'); + } + }); + // invoke the invalidate task await runInvalidateTask();