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..9aea20f42e5f9 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,13 @@ export default function apiKeyBackfillTests({ getService }: FtrProviderContext) expect(e?.event?.outcome).to.eql('success'); } + // wait for all the api_key_pending_invalidation SOs to be deleted + await retry.try(async () => { + const results = await getApiKeysPendingInvalidation(); + expect(results.length).to.eql(0); + return results; + }); + // invoke the invalidate task await runInvalidateTask();