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();