use of org.apache.druid.indexing.common.TaskToolbox in project druid by druid-io.
the class WorkerTaskManagerTest method testTaskStatusWhenTaskRunnerFutureThrowsException.
@Test(timeout = 30_000L)
public void testTaskStatusWhenTaskRunnerFutureThrowsException() throws Exception {
Task task = new NoopTask("id", null, null, 100, 0, null, null, ImmutableMap.of(Tasks.PRIORITY_KEY, 0)) {
@Override
public TaskStatus run(TaskToolbox toolbox) {
throw new Error("task failure test");
}
};
workerTaskManager.start();
workerTaskManager.assignTask(task);
Map<String, TaskAnnouncement> completeTasks;
do {
completeTasks = workerTaskManager.getCompletedTasks();
} while (completeTasks.isEmpty());
Assert.assertEquals(1, completeTasks.size());
TaskAnnouncement announcement = completeTasks.get(task.getId());
Assert.assertNotNull(announcement);
Assert.assertEquals(TaskState.FAILED, announcement.getStatus());
Assert.assertEquals("Failed to run task with an exception. See middleManager or indexer logs for more details.", announcement.getTaskStatus().getErrorMsg());
}
Aggregations