Skip to content

Commit

Permalink
Run "mark_removed_tasks_as_unrecognized" task after creating test tas…
Browse files Browse the repository at this point in the history
…ks (#206598)

Fixes: #194208

The test fails because the the task marks the removed task as
unrecognized has run before the test tasks are created.
This PR adds a runSoon request that runs the above task after creating
the test tasks.
  • Loading branch information
ersin-erdal authored Jan 27, 2025
1 parent 665cfe0 commit 773df93
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ jest.mock('../monitoring/workload_statistics', () => {
};
});

// FLAKY: https://github.com/elastic/kibana/issues/194208
describe.skip('unrecognized task types', () => {
describe('unrecognized task types', () => {
let esServer: TestElasticsearchUtils;
let kibanaServer: TestKibanaUtils;
let taskManagerPlugin: TaskManagerStartContract;
Expand Down Expand Up @@ -113,6 +112,10 @@ describe.skip('unrecognized task types', () => {
taskIdsToRemove.push(removeTypeId);
taskIdsToRemove.push(notRegisteredTypeId);

// To be sure that the background task that marks removed tasks as unrecognized has run after the tasks were created
const runSoonResponse = await taskManagerPlugin.runSoon('mark_removed_tasks_as_unrecognized');
expect(runSoonResponse).toEqual({ id: 'mark_removed_tasks_as_unrecognized' });

await retry(async () => {
const task = await getTask(kibanaServer.coreStart.elasticsearch.client.asInternalUser);
expect(task?._source?.task?.status).toBe('unrecognized');
Expand Down

0 comments on commit 773df93

Please sign in to comment.