use of com.twitter.heron.scheduler.client.ISchedulerClient in project heron by twitter.
the class RuntimeManagerRunnerTest method testRestartTopologyHandlerFailDeleteTMasterLoc.
@Test(expected = TopologyRuntimeManagementException.class)
public void testRestartTopologyHandlerFailDeleteTMasterLoc() {
ISchedulerClient client = mock(ISchedulerClient.class);
SchedulerStateManagerAdaptor adaptor = mock(SchedulerStateManagerAdaptor.class);
RuntimeManagerRunner runner = newRuntimeManagerRunner(Command.RESTART, client);
// Restart container 1, not containing TMaster
Scheduler.RestartTopologyRequest restartTopologyRequest = Scheduler.RestartTopologyRequest.newBuilder().setTopologyName(TOPOLOGY_NAME).setContainerIndex(1).build();
when(config.getIntegerValue(Key.TOPOLOGY_CONTAINER_ID)).thenReturn(1);
// Restart container 0, containing TMaster
when(config.getIntegerValue(Key.TOPOLOGY_CONTAINER_ID)).thenReturn(0);
when(runtime.get(Key.SCHEDULER_STATE_MANAGER_ADAPTOR)).thenReturn(adaptor);
when(adaptor.deleteTMasterLocation(TOPOLOGY_NAME)).thenReturn(false);
try {
runner.restartTopologyHandler(TOPOLOGY_NAME);
} finally {
// DeleteTMasterLocation should be invoked
verify(adaptor).deleteTMasterLocation(TOPOLOGY_NAME);
}
}
Aggregations