|
66 | 66 | import java.util.stream.StreamSupport;
|
67 | 67 |
|
68 | 68 | import static org.hamcrest.Matchers.anyOf;
|
69 |
| -import static org.hamcrest.Matchers.containsString; |
70 | 69 | import static org.hamcrest.Matchers.empty;
|
71 | 70 | import static org.hamcrest.Matchers.equalTo;
|
72 | 71 | import static org.hamcrest.Matchers.hasSize;
|
@@ -260,7 +259,7 @@ public void testFailedToStartChildTaskAfterCancelled() throws Exception {
|
260 | 259 | beforeSendLatches.get(subRequest).countDown();
|
261 | 260 | mainAction.startSubTask(taskId, subRequest, future);
|
262 | 261 | TaskCancelledException te = expectThrows(TaskCancelledException.class, future::actionGet);
|
263 |
| - assertThat(te.getMessage(), equalTo("The parent task was cancelled, shouldn't start any child tasks")); |
| 262 | + assertThat(te.getMessage(), equalTo("parent task was cancelled [by user request]")); |
264 | 263 | allowEntireRequest(rootRequest);
|
265 | 264 | waitForRootTask(rootTaskFuture);
|
266 | 265 | ensureAllBansRemoved();
|
@@ -330,7 +329,7 @@ public void testRemoveBanParentsOnDisconnect() throws Exception {
|
330 | 329 | TaskManager taskManager = internalCluster().getInstance(TransportService.class, node.getName()).getTaskManager();
|
331 | 330 | for (TaskId bannedParent : bannedParents) {
|
332 | 331 | if (bannedParent.getNodeId().equals(node.getId()) && randomBoolean()) {
|
333 |
| - Collection<Transport.Connection> childConns = taskManager.startBanOnChildTasks(bannedParent.getId(), () -> {}); |
| 332 | + Collection<Transport.Connection> childConns = taskManager.startBanOnChildTasks(bannedParent.getId(), "", () -> {}); |
334 | 333 | for (Transport.Connection connection : randomSubsetOf(childConns)) {
|
335 | 334 | connection.close();
|
336 | 335 | }
|
@@ -365,9 +364,9 @@ static void waitForRootTask(ActionFuture<TestResponse> rootTask) {
|
365 | 364 | final Throwable cause = ExceptionsHelper.unwrap(e, TaskCancelledException.class);
|
366 | 365 | assertNotNull(cause);
|
367 | 366 | assertThat(cause.getMessage(), anyOf(
|
368 |
| - equalTo("The parent task was cancelled, shouldn't start any child tasks"), |
369 |
| - containsString("Task cancelled before it started:"), |
370 |
| - equalTo("Task was cancelled while executing"))); |
| 367 | + equalTo("parent task was cancelled [by user request]"), |
| 368 | + equalTo("task cancelled before starting [by user request]"), |
| 369 | + equalTo("task cancelled [by user request]"))); |
371 | 370 | }
|
372 | 371 | }
|
373 | 372 |
|
@@ -475,9 +474,7 @@ protected void doExecute(Task task, TestRequest request, ActionListener<TestResp
|
475 | 474 | new GroupedActionListener<>(listener.map(r -> new TestResponse()), subRequests.size() + 1);
|
476 | 475 | transportService.getThreadPool().generic().execute(ActionRunnable.supply(groupedListener, () -> {
|
477 | 476 | assertTrue(beforeExecuteLatches.get(request).await(60, TimeUnit.SECONDS));
|
478 |
| - if (((CancellableTask) task).isCancelled()) { |
479 |
| - throw new TaskCancelledException("Task was cancelled while executing"); |
480 |
| - } |
| 477 | + ((CancellableTask)task).ensureNotCancelled(); |
481 | 478 | return new TestResponse();
|
482 | 479 | }));
|
483 | 480 | for (TestRequest subRequest : subRequests) {
|
|
0 commit comments