Search in sources :

Example 1 with RuntimeLogEvent

use of org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent in project che-server by eclipse-che.

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));
}
Also used : RuntimeLogEvent(org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent) PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Example 2 with RuntimeLogEvent

use of org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent 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));
}
Also used : RuntimeLogEvent(org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent) PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Aggregations

RuntimeLogEvent (org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent)2 PodEvent (org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent)2 Test (org.testng.annotations.Test)2