use of io.druid.indexing.common.task.RealtimeIndexTask in project druid by druid-io.
the class TaskLifecycleTest method testRealtimeIndexTaskFailure.
@Test(timeout = 60_000L)
public void testRealtimeIndexTaskFailure() throws Exception {
dataSegmentPusher = new DataSegmentPusher() {
@Deprecated
@Override
public String getPathForHadoop(String s) {
return getPathForHadoop();
}
@Override
public String getPathForHadoop() {
throw new UnsupportedOperationException();
}
@Override
public DataSegment push(File file, DataSegment dataSegment) throws IOException {
throw new RuntimeException("FAILURE");
}
};
tb = setUpTaskToolboxFactory(dataSegmentPusher, handoffNotifierFactory, mdc);
taskRunner = setUpThreadPoolTaskRunner(tb);
taskQueue = setUpTaskQueue(taskStorage, taskRunner);
monitorScheduler.addMonitor(EasyMock.anyObject(Monitor.class));
EasyMock.expectLastCall().atLeastOnce();
monitorScheduler.removeMonitor(EasyMock.anyObject(Monitor.class));
EasyMock.expectLastCall().anyTimes();
EasyMock.replay(monitorScheduler, queryRunnerFactoryConglomerate);
RealtimeIndexTask realtimeIndexTask = newRealtimeIndexTask();
final String taskId = realtimeIndexTask.getId();
taskQueue.start();
taskQueue.add(realtimeIndexTask);
// Wait for realtime index task to fail
while (tsqa.getStatus(taskId).get().isRunnable()) {
Thread.sleep(10);
}
Assert.assertTrue("Task should be in Failure state", tsqa.getStatus(taskId).get().isFailure());
EasyMock.verify(monitorScheduler, queryRunnerFactoryConglomerate);
}
Aggregations