use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.
the class UnrecoverablePodEventListenerTest method testDoNotHandleUnrecoverableEventFromNonWorkspacePod.
@Test
public void testDoNotHandleUnrecoverableEventFromNonWorkspacePod() throws Exception {
// given
final String unrecoverableEventMessage = "Failed to pull image eclipse/che-server:nightly-centos";
final PodEvent unrecoverableEvent = mockContainerEvent("NonWorkspacePod", "Pulling", unrecoverableEventMessage, EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
// when
unrecoverableEventListener.handle(unrecoverableEvent);
// then
verify(unrecoverableEventConsumer, never()).accept(any());
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.
the class UnrecoverablePodEventListenerTest method testHandleUnrecoverableEventByMessage.
@Test
public void testHandleUnrecoverableEventByMessage() throws Exception {
// given
String unrecoverableEventMessage = "Failed to pull image eclipse/che-server:nightly-centos";
PodEvent unrecoverableEvent = mockContainerEvent(WORKSPACE_POD_NAME, "Pulling", unrecoverableEventMessage, EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
// when
unrecoverableEventListener.handle(unrecoverableEvent);
// then
verify(unrecoverableEventConsumer).accept(unrecoverableEvent);
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.
the class UnrecoverablePodEventListenerTest method testHandleRegularEvent.
@Test
public void testHandleRegularEvent() throws Exception {
// given
final PodEvent regularEvent = mockContainerEvent(WORKSPACE_POD_NAME, "Pulling", "pulling image", EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
// when
unrecoverableEventListener.handle(regularEvent);
// then
verify(unrecoverableEventConsumer, never()).accept(any());
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.
the class UnrecoverablePodEventListenerTest method testFailedContainersInWorkspacePodAlwaysHandled.
@Test
public void testFailedContainersInWorkspacePodAlwaysHandled() {
// given
PodEvent ev = mockContainerEvent(WORKSPACE_POD_NAME, "Failed", "bah", EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
// when
unrecoverableEventListener.handle(ev);
// then
verify(unrecoverableEventConsumer).accept(any());
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project devspaces-images by redhat-developer.
the class KubernetesInternalRuntimeTest method testRepublishContainerOutputAsMachineLogEvents.
@Test
public void testRepublishContainerOutputAsMachineLogEvents() throws Exception {
final MachineLogsPublisher logsPublisher = new MachineLogsPublisher(eventPublisher, machinesCache, IDENTITY);
final PodEvent out1 = mockContainerEventWithoutRandomName(WORKSPACE_POD_NAME, "Pulling", "pulling image", EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
final PodEvent out2 = mockContainerEventWithoutRandomName(WORKSPACE_POD_NAME, "Pulled", "image pulled", EVENT_CREATION_TIMESTAMP, getCurrentTimestampWithOneHourShiftAhead());
final ArgumentCaptor<RuntimeLogEvent> captor = ArgumentCaptor.forClass(RuntimeLogEvent.class);
internalRuntime.doStartMachine(serverResolver);
logsPublisher.handle(out1);
logsPublisher.handle(out2);
verify(eventService, atLeastOnce()).publish(captor.capture());
final ImmutableList<RuntimeLogEvent> machineLogs = ImmutableList.of(asRuntimeLogEvent(out1), asRuntimeLogEvent(out2));
assertTrue(captor.getAllValues().containsAll(machineLogs));
}
Aggregations