Skip to content

Commit

Permalink
Rethrottle tests wait for task to start (#77822)
Browse files Browse the repository at this point in the history
Improved how we wait for tasks to really start, to ensure that
rethrottle does not fail the test.

Closes #75327
  • Loading branch information
henningandersen committed Oct 27, 2021
1 parent c212de0 commit cda052e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ protected static TaskId findTaskToRethrottle(String actionName, String descripti
TaskGroup taskGroup = taskGroups.get(0);
assertThat(taskGroup.getChildTasks(), empty());
// check that the task initialized enough that it can rethrottle too.
if (((RawTaskStatus) taskGroup.getTaskInfo().getStatus()).toMap().containsKey("batches")) {
Map<String, Object> statusMap = ((RawTaskStatus) taskGroup.getTaskInfo().getStatus()).toMap();
if (statusMap.get("batches").equals(1)) {
return taskGroup.getTaskInfo().getTaskId();
}
} while (System.nanoTime() - start < TimeUnit.SECONDS.toNanos(10));
Expand Down

0 comments on commit cda052e

Please sign in to comment.