Search in sources :

Example 6 with PodEvent

use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.

the class LogWatcherTest method executorIsCalledWhenAllIsSet.

@Test
public void executorIsCalledWhenAllIsSet() throws InfrastructureException {
    // given
    LogWatcher logWatcher = new LogWatcher(clientFactory, eventsPublisher, WORKSPACE_ID, NAMESPACE, PODNAMES, executor, TIMEOUTS, LIMIT_BYTES);
    logWatcher.addLogHandler(handler);
    PodEvent podEvent = new PodEvent(POD, "container123", "Started", "someevenbettermessage", "123456789", "987654321");
    // when
    logWatcher.handle(podEvent);
    // then
    verify(executor, times(1)).execute(any());
}
Also used : PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Example 7 with PodEvent

use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.

the class LogWatcherTest method executorIsNotCalledWhenPodNameDontMatch.

@Test
public void executorIsNotCalledWhenPodNameDontMatch() throws InfrastructureException {
    // given
    LogWatcher logWatcher = new LogWatcher(clientFactory, eventsPublisher, WORKSPACE_ID, NAMESPACE, PODNAMES, executor, TIMEOUTS, LIMIT_BYTES);
    logWatcher.addLogHandler(handler);
    PodEvent podEvent = new PodEvent("someOtherPod", "container123", "Started", "someevenbettermessage", "123456789", "987654321");
    // when
    logWatcher.handle(podEvent);
    // then
    verify(executor, times(0)).execute(any());
}
Also used : PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Example 8 with PodEvent

use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project che-server by eclipse-che.

the class LogWatcherTest method executorIsNotCalledWhenContainerIsNull.

@Test
public void executorIsNotCalledWhenContainerIsNull() throws InfrastructureException {
    // given
    LogWatcher logWatcher = new LogWatcher(clientFactory, eventsPublisher, WORKSPACE_ID, NAMESPACE, PODNAMES, executor, TIMEOUTS, LIMIT_BYTES);
    logWatcher.addLogHandler(handler);
    PodEvent podEvent = new PodEvent(POD, null, "somereallygoodreason", "someevenbettermessage", "123456789", "987654321");
    // when
    logWatcher.handle(podEvent);
    // then
    verify(executor, times(0)).execute(any());
}
Also used : PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Example 9 with PodEvent

use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project devspaces-images by redhat-developer.

the class LogWatcherTest method executorIsNotCalledWhenContainerIsNull.

@Test
public void executorIsNotCalledWhenContainerIsNull() throws InfrastructureException {
    // given
    LogWatcher logWatcher = new LogWatcher(clientFactory, eventsPublisher, WORKSPACE_ID, NAMESPACE, PODNAMES, executor, TIMEOUTS, LIMIT_BYTES);
    logWatcher.addLogHandler(handler);
    PodEvent podEvent = new PodEvent(POD, null, "somereallygoodreason", "someevenbettermessage", "123456789", "987654321");
    // when
    logWatcher.handle(podEvent);
    // then
    verify(executor, times(0)).execute(any());
}
Also used : PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Example 10 with PodEvent

use of org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent in project devspaces-images by redhat-developer.

the class LogWatcherTest method executorIsNotCalledWhenReasonIsNotStarted.

@Test
public void executorIsNotCalledWhenReasonIsNotStarted() throws InfrastructureException {
    // given
    LogWatcher logWatcher = new LogWatcher(clientFactory, eventsPublisher, WORKSPACE_ID, NAMESPACE, PODNAMES, executor, TIMEOUTS, LIMIT_BYTES);
    logWatcher.addLogHandler(handler);
    PodEvent podEvent = new PodEvent(POD, "container123", "NotStarted", "someevenbettermessage", "123456789", "987654321");
    // when
    logWatcher.handle(podEvent);
    // then
    verify(executor, times(0)).execute(any());
}
Also used : PodEvent(org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent) Test(org.testng.annotations.Test)

Aggregations

PodEvent (org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent)40 Test (org.testng.annotations.Test)32 Event (io.fabric8.kubernetes.api.model.Event)8 Date (java.util.Date)8 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)6 Calendar (java.util.Calendar)6 LocalObjectReference (io.fabric8.kubernetes.api.model.LocalObjectReference)2 ObjectReference (io.fabric8.kubernetes.api.model.ObjectReference)2 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)2 Watcher (io.fabric8.kubernetes.client.Watcher)2 WatcherException (io.fabric8.kubernetes.client.WatcherException)2 Field (java.lang.reflect.Field)2 ParseException (java.text.ParseException)2 Matcher (java.util.regex.Matcher)2 RuntimeLogEvent (org.eclipse.che.api.workspace.shared.dto.event.RuntimeLogEvent)2 KubernetesInfrastructureException (org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException)2 LogWatcher (org.eclipse.che.workspace.infrastructure.kubernetes.namespace.log.LogWatcher)2