Search in sources :

Example 1 with LocalSchedulerEvent

use of com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent in project titus-control-plane by Netflix.

the class DefaultLocalSchedulerTest method expectScheduleUpdateEvent.

private ScheduleUpdateEvent expectScheduleUpdateEvent(SchedulingState expectedState) throws InterruptedException {
    LocalSchedulerEvent event = eventSubscriber.takeNext(Duration.ofSeconds(5));
    assertThat(event).isInstanceOf(ScheduleUpdateEvent.class);
    assertThat(event.getSchedule().getCurrentAction().getStatus().getState()).isEqualTo(expectedState);
    return (ScheduleUpdateEvent) event;
}
Also used : LocalSchedulerEvent(com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent) ScheduleUpdateEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent)

Example 2 with LocalSchedulerEvent

use of com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent in project titus-control-plane by Netflix.

the class DefaultLocalSchedulerTest method expectScheduleAdded.

private void expectScheduleAdded(ScheduleReference reference) throws InterruptedException {
    assertThat(reference.isClosed()).isFalse();
    LocalSchedulerEvent addedEvent = eventSubscriber.takeNext(Duration.ofSeconds(5));
    assertThat(addedEvent).isInstanceOf(ScheduleAddedEvent.class);
    assertThat(addedEvent.getSchedule().getCurrentAction().getStatus().getState()).isEqualTo(SchedulingState.Waiting);
    assertThat(localScheduler.findSchedule(reference.getSchedule().getId())).isPresent();
}
Also used : LocalSchedulerEvent(com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent)

Example 3 with LocalSchedulerEvent

use of com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent in project titus-control-plane by Netflix.

the class DefaultLocalSchedulerTest method expectScheduleRemoved.

private void expectScheduleRemoved(ScheduleReference reference) throws InterruptedException {
    assertThat(reference.isClosed()).isTrue();
    LocalSchedulerEvent removedEvent = eventSubscriber.takeUntil(e -> e instanceof ScheduleRemovedEvent, Duration.ofSeconds(5));
    Schedule schedule = removedEvent.getSchedule();
    assertThat(schedule.getCurrentAction().getStatus().getState().isFinal()).isTrue();
    assertThat(localScheduler.getArchivedSchedules()).hasSize(1);
    assertThat(localScheduler.getArchivedSchedules().get(0).getId()).isEqualTo(reference.getSchedule().getId());
}
Also used : ScheduleRemovedEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent) LocalSchedulerEvent(com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent) Schedule(com.netflix.titus.common.framework.scheduler.model.Schedule)

Aggregations

LocalSchedulerEvent (com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent)3 Schedule (com.netflix.titus.common.framework.scheduler.model.Schedule)1 ScheduleRemovedEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent)1 ScheduleUpdateEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent)1