Skip to content

Commit 56a19f9

Browse files
authored
Fix TasksIT#testTasksCancellation (#109929)
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
1 parent d1e3c0a commit 56a19f9

File tree

1 file changed

+3
-1
lines changed
  • server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/node/tasks

1 file changed

+3
-1
lines changed

server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ public void onTaskRegistered(Task task) {
488488
}
489489
}
490490

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

512511
expectThrows(TaskCancelledException.class, future);
513512

513+
logger.info("--> waiting for all ongoing tasks to complete within a reasonable time");
514+
safeGet(clusterAdmin().prepareListTasks().setActions(TEST_TASK_ACTION.name() + "*").setWaitForCompletion(true).execute());
515+
514516
logger.info("--> checking that test tasks are not running");
515517
assertEquals(0, clusterAdmin().prepareListTasks().setActions(TEST_TASK_ACTION.name() + "*").get().getTasks().size());
516518
}

0 commit comments

Comments
 (0)