Search in sources :

Example 11 with ISchedulerClient

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);
    }
}
Also used : ISchedulerClient(com.twitter.heron.scheduler.client.ISchedulerClient) Scheduler(com.twitter.heron.proto.scheduler.Scheduler) SchedulerStateManagerAdaptor(com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

ISchedulerClient (com.twitter.heron.scheduler.client.ISchedulerClient)11 SchedulerStateManagerAdaptor (com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor)10 Test (org.junit.Test)9 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)9 Scheduler (com.twitter.heron.proto.scheduler.Scheduler)7 Config (com.twitter.heron.spi.common.Config)4 IStateManager (com.twitter.heron.spi.statemgr.IStateManager)4 RoundRobinPacking (com.twitter.heron.packing.roundrobin.RoundRobinPacking)2 PackingPlans (com.twitter.heron.proto.system.PackingPlans)2 ResourceCompliantRRPacking (com.twitter.heron.packing.roundrobin.ResourceCompliantRRPacking)1 IRepacking (com.twitter.heron.spi.packing.IRepacking)1