use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent 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.ScheduleUpdateEvent in project titus-control-plane by Netflix.
the class LocalSchedulerTransactionLoggerTest method testDoFormatScheduleFailureUpdate.
@Test
public void testDoFormatScheduleFailureUpdate() {
Schedule schedule = updateStatus(REFERENCE_SCHEDULE, newSchedulingStatus(SchedulingState.Failed));
verify(LocalSchedulerTransactionLogger.doFormat(new ScheduleUpdateEvent(schedule)));
}
use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent in project titus-control-plane by Netflix.
the class LocalSchedulerTransactionLoggerTest method testDoFormatScheduleSuccessUpdate.
@Test
public void testDoFormatScheduleSuccessUpdate() {
Schedule schedule = updateStatus(REFERENCE_SCHEDULE, newSchedulingStatus(SchedulingState.Succeeded));
verify(LocalSchedulerTransactionLogger.doFormat(new ScheduleUpdateEvent(schedule)));
}
use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent in project titus-control-plane by Netflix.
the class DefaultLocalSchedulerTest method testExecutionLifecycle.
private void testExecutionLifecycle(ScheduleReference reference, AtomicLong tickCounter) throws InterruptedException {
// Schedule, and first iteration
expectScheduleAdded(reference);
expectScheduleUpdateEvent(SchedulingState.Running);
expectScheduleUpdateEvent(SchedulingState.Succeeded);
assertThat(tickCounter.get()).isGreaterThan(0);
// Next running
expectScheduleUpdateEvent(SchedulingState.Waiting);
expectScheduleUpdateEvent(SchedulingState.Running);
ScheduleUpdateEvent succeededEvent2 = expectScheduleUpdateEvent(SchedulingState.Succeeded);
assertThat(succeededEvent2.getSchedule().getCompletedActions()).hasSize(1);
// Now cancel it
assertThat(reference.isClosed()).isFalse();
reference.cancel();
await().atMost(30, TimeUnit.SECONDS).until(reference::isClosed);
assertThat(reference.getSchedule().getCurrentAction().getStatus().getState().isFinal()).isTrue();
assertThat(localScheduler.getActiveSchedules()).isEmpty();
assertThat(localScheduler.getArchivedSchedules()).hasSize(1);
expectScheduleRemoved(reference);
}
use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent in project titus-control-plane by Netflix.
the class LocalSchedulerTransactionLoggerTest method testDoFormatScheduleRunningUpdate.
@Test
public void testDoFormatScheduleRunningUpdate() {
Schedule schedule = updateStatus(REFERENCE_SCHEDULE, newSchedulingStatus(SchedulingState.Running));
verify(LocalSchedulerTransactionLogger.doFormat(new ScheduleUpdateEvent(schedule)));
}
Aggregations