Skip to content

Commit

Permalink
Fix TasksIT#testTasksCancellation (elastic#109929)
Browse files Browse the repository at this point in the history
The tasks are removed from the task manager _after_ sending the
response, so we cannot reliably assert they're done. With this commit we
wait for them to complete properly first.

Closes elastic#109686
  • Loading branch information
DaveCTurner committed Jun 19, 2024
1 parent 65ec438 commit 6a7c918
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ public void onTaskRegistered(Task task) {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/109686")
public void testTasksCancellation() throws Exception {
// Start blocking test task
// Get real client (the plugin is not registered on transport nodes)
Expand All @@ -510,6 +509,9 @@ public void testTasksCancellation() throws Exception {

expectThrows(TaskCancelledException.class, future);

logger.info("--> waiting for all ongoing tasks to complete within a reasonable time");
safeGet(clusterAdmin().prepareListTasks().setActions(TEST_TASK_ACTION.name() + "*").setWaitForCompletion(true).execute());

logger.info("--> checking that test tasks are not running");
assertEquals(0, clusterAdmin().prepareListTasks().setActions(TEST_TASK_ACTION.name() + "*").get().getTasks().size());
}
Expand Down

0 comments on commit 6a7c918

Please sign in to comment.