use of org.eclipse.che.api.core.model.workspace.runtime.MachineStatus.STARTING in project che-server by eclipse-che.
the class KubernetesInternalRuntimeTest method stopsWaitingAllMachineStartWhenOneMachineStartFailed.
@Test(expectedExceptions = InfrastructureException.class)
public void stopsWaitingAllMachineStartWhenOneMachineStartFailed() throws Exception {
final Container container1 = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1);
final Container container2 = mockContainer(CONTAINER_NAME_2, EXPOSED_PORT_2, INTERNAL_PORT);
final ImmutableMap<String, Pod> allPods = ImmutableMap.of(WORKSPACE_POD_NAME, mockPod(ImmutableList.of(container1, container2)));
when(k8sEnv.getPodsCopy()).thenReturn(allPods);
internalRuntime = spy(internalRuntime);
doThrow(IllegalStateException.class).when(internalRuntime).waitRunningAsync(any(), argThat(m -> m.getName().equals(M1_NAME)));
try {
internalRuntime.start(emptyMap());
} catch (Exception rethrow) {
verify(deployments).deploy(any(Pod.class));
verify(ingresses).create(any());
verify(services).create(any());
verify(eventService, atLeastOnce()).publish(any());
final List<MachineStatusEvent> events = captureEvents();
assertTrue(events.contains(newEvent(M1_NAME, STARTING)));
throw rethrow;
}
}
use of org.eclipse.che.api.core.model.workspace.runtime.MachineStatus.STARTING in project devspaces-images by redhat-developer.
the class KubernetesInternalRuntimeTest method stopsWaitingAllMachineStartWhenOneMachineStartFailed.
@Test(expectedExceptions = InfrastructureException.class)
public void stopsWaitingAllMachineStartWhenOneMachineStartFailed() throws Exception {
final Container container1 = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1);
final Container container2 = mockContainer(CONTAINER_NAME_2, EXPOSED_PORT_2, INTERNAL_PORT);
final ImmutableMap<String, Pod> allPods = ImmutableMap.of(WORKSPACE_POD_NAME, mockPod(ImmutableList.of(container1, container2)));
when(k8sEnv.getPodsCopy()).thenReturn(allPods);
internalRuntime = spy(internalRuntime);
doThrow(IllegalStateException.class).when(internalRuntime).waitRunningAsync(any(), argThat(m -> m.getName().equals(M1_NAME)));
try {
internalRuntime.start(emptyMap());
} catch (Exception rethrow) {
verify(deployments).deploy(any(Pod.class));
verify(ingresses).create(any());
verify(services).create(any());
verify(eventService, atLeastOnce()).publish(any());
final List<MachineStatusEvent> events = captureEvents();
assertTrue(events.contains(newEvent(M1_NAME, STARTING)));
throw rethrow;
}
}
Aggregations