From 02fe363485b373098a95db850ace060c50f928ad Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 1 Nov 2024 07:24:48 +1100 Subject: [PATCH] [8.x] Wait for backfill SOs to be deleted before running the invalidate API key task (#198422) (#198601) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.x`: - [Wait for backfill SOs to be deleted before running the invalidate API key task (#198422)](https://github.com/elastic/kibana/pull/198422) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Mike Côté --- .../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();