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;
}
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();
}
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());
}
Aggregations