Search in sources :

Example 21 with ScheduleEntity

use of pipelite.entity.ScheduleEntity in project pipelite by enasequence.

the class ScheduleRunnerTest method deleteSchedule.

private void deleteSchedule(TestSchedule testSchedule) {
    ScheduleEntity schedule = new ScheduleEntity();
    schedule.setPipelineName(testSchedule.pipelineName());
    scheduleService.delete(schedule);
    System.out.println("deleted schedule for pipeline: " + testSchedule.pipelineName());
}
Also used : ScheduleEntity(pipelite.entity.ScheduleEntity)

Example 22 with ScheduleEntity

use of pipelite.entity.ScheduleEntity in project pipelite by enasequence.

the class ScheduleEntityAsserter method assertCompletedScheduleEntity.

public static void assertCompletedScheduleEntity(ScheduleService scheduleService, TestType testType, String serviceName, String pipelineName, int processCnt, Collection<String> processIds) {
    ScheduleEntity scheduleEntity = scheduleService.getSavedSchedule(pipelineName).get();
    assertThat(scheduleEntity.getServiceName()).isEqualTo(serviceName);
    assertThat(scheduleEntity.getPipelineName()).isEqualTo(pipelineName);
    assertThat(scheduleEntity.getProcessId()).isEqualTo(Iterables.getLast(processIds));
    assertThat(scheduleEntity.getExecutionCount()).isEqualTo(processCnt);
    assertThat(scheduleEntity.getStartTime()).isNotNull();
    assertThat(scheduleEntity.getEndTime()).isAfterOrEqualTo(scheduleEntity.getStartTime());
    if (testType.expectedStageSuccessCnt() > 0) {
        assertThat(scheduleEntity.getLastFailed()).isNull();
        assertThat(scheduleEntity.getLastCompleted()).isAfterOrEqualTo(scheduleEntity.getStartTime());
        assertThat(scheduleEntity.getStreakFailed()).isEqualTo(0);
        assertThat(scheduleEntity.getStreakCompleted()).isEqualTo(processCnt);
    } else {
        assertThat(scheduleEntity.getLastFailed()).isAfterOrEqualTo(scheduleEntity.getStartTime());
        assertThat(scheduleEntity.getLastCompleted()).isNull();
        assertThat(scheduleEntity.getStreakFailed()).isEqualTo(processCnt);
        assertThat(scheduleEntity.getStreakCompleted()).isEqualTo(0);
    }
}
Also used : ScheduleEntity(pipelite.entity.ScheduleEntity)

Aggregations

ScheduleEntity (pipelite.entity.ScheduleEntity)22 ProcessEntity (pipelite.entity.ProcessEntity)9 Test (org.junit.jupiter.api.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 ZonedDateTime (java.time.ZonedDateTime)5 Timed (io.micrometer.core.annotation.Timed)4 PipeliteProcessRetryException (pipelite.exception.PipeliteProcessRetryException)4 Schedule (pipelite.Schedule)2 StageEntity (pipelite.entity.StageEntity)2 PipeliteException (pipelite.exception.PipeliteException)2 Process (pipelite.process.Process)2 Duration (java.time.Duration)1 List (java.util.List)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 PostConstruct (javax.annotation.PostConstruct)1 Getter (lombok.Getter)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 AfterEach (org.junit.jupiter.api.AfterEach)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 TestConfiguration (org.springframework.boot.test.context.TestConfiguration)1