Skip to content

Commit

Permalink
Fix TasksIT#testTasksCancellation (#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 #109686
  • Loading branch information
DaveCTurner authored Jun 19, 2024
1 parent d1e3c0a commit 56a19f9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,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 @@ -511,6 +510,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 56a19f9

Please sign in to comment.