use of com.twitter.heron.scheduler.TopologyRuntimeManagementException in project incubator-heron by apache.
the class KubernetesSchedulerTest method testRemoveContainers.
@Test
public void testRemoveContainers() throws Exception {
KubernetesController controller = Mockito.mock(KubernetesController.class);
Mockito.doReturn(controller).when(scheduler).getController();
scheduler.initialize(config, mockRuntime);
Set<PackingPlan.ContainerPlan> containers = new HashSet<>();
containers.add(PackingTestUtils.testContainerPlan(0));
// Failure to remove container
Mockito.doThrow(new TopologyRuntimeManagementException("")).when(controller).removeContainers(Mockito.anySetOf(PackingPlan.ContainerPlan.class));
expectedException.expect(TopologyRuntimeManagementException.class);
scheduler.removeContainers(containers);
// Successful removal
Mockito.doNothing().when(controller).removeContainers(Mockito.anySetOf(PackingPlan.ContainerPlan.class));
scheduler.removeContainers(containers);
}
Aggregations