diff --git a/x-pack/platform/plugins/shared/task_manager/server/integration_tests/removed_types.test.ts b/x-pack/platform/plugins/shared/task_manager/server/integration_tests/removed_types.test.ts index 6601449a379f1..2edd4ee48c2a3 100644 --- a/x-pack/platform/plugins/shared/task_manager/server/integration_tests/removed_types.test.ts +++ b/x-pack/platform/plugins/shared/task_manager/server/integration_tests/removed_types.test.ts @@ -126,6 +126,15 @@ describe('unrecognized task types', () => { } }); + // wait until the task finishes + await retry(async () => { + const hasRun = await taskManagerPlugin + .get('mark_removed_tasks_as_unrecognized') + .then((t) => t.runAt != null) + .catch(() => false); + expect(hasRun).toBe(true); + }); + await retry(async () => { const task = await getTask(kibanaServer.coreStart.elasticsearch.client.asInternalUser); expect(task?._source?.task?.status).toBe('unrecognized');