Skip to content

Commit

Permalink
Revert "Fix TasksIT#testGetTaskWaitForCompletionWithoutStoringResult"
Browse files Browse the repository at this point in the history
This reverts commit bf3b27d.
  • Loading branch information
arteam committed May 20, 2024
1 parent 1b2bded commit e8241a5
Showing 1 changed file with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -853,21 +853,40 @@ public void testNodeNotFoundButTaskFound() throws Exception {
// Save a fake task that looks like it is from a node that isn't part of the cluster
CyclicBarrier b = new CyclicBarrier(2);
TaskResultsService resultsService = internalCluster().getInstance(TaskResultsService.class);
resultsService.storeResult(new TaskResult(fakeTask(), new RuntimeException("test")), new ActionListener<Void>() {
@Override
public void onResponse(Void response) {
try {
b.await();
} catch (InterruptedException | BrokenBarrierException e) {
onFailure(e);
resultsService.storeResult(
new TaskResult(
new TaskInfo(
new TaskId("fake", 1),
"test",
"fake",
"test",
"",
null,
0,
0,
false,
false,
TaskId.EMPTY_TASK_ID,
Collections.emptyMap()
),
new RuntimeException("test")
),
new ActionListener<Void>() {
@Override
public void onResponse(Void response) {
try {
b.await();
} catch (InterruptedException | BrokenBarrierException e) {
onFailure(e);
}
}
}

@Override
public void onFailure(Exception e) {
throw new RuntimeException(e);
@Override
public void onFailure(Exception e) {
throw new RuntimeException(e);
}
}
});
);
b.await();

// Now we can find it!
Expand Down Expand Up @@ -978,21 +997,4 @@ private GetTaskResponse expectFinishedTask(TaskId taskId) throws IOException {
assertNull(info.status()); // The test task doesn't have any status
return response;
}

private static TaskInfo fakeTask() {
return new TaskInfo(
new TaskId("fake", 1),
"test",
"fake",
"test",
"",
null,
0,
0,
false,
false,
TaskId.EMPTY_TASK_ID,
Collections.emptyMap()
);
}
}

0 comments on commit e8241a5

Please sign in to comment.