use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineRunnerHighParallelismSyncTest method test.
private void test(SyncTestPipeline pipeline) {
String pipelineName = pipeline.pipelineName();
PipelineRunner pipelineRunner = pipeliteServices.runner().getPipelineRunner(pipelineName).get();
assertThat(pipelineRunner.getActiveProcessRunners().size()).isEqualTo(0);
PipelineMetrics pipelineMetrics = metrics.pipeline(pipelineName);
assertThat(pipelineMetrics.process().getInternalErrorCount()).isEqualTo(0);
// TODO: higher than expected completed count
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getFailedCount()).isZero();
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(0);
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(PROCESS_CNT);
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineRunnerFailureTest method assertMetrics.
private void assertMetrics(TestPipeline f) {
PipelineMetrics pipelineMetrics = metrics.pipeline(f.pipelineName());
TestProcess t = f.testProcessConfiguration();
if (t.getFirstStageExecResult().isSuccess() && t.getSecondStageExecResult().isSuccess() && t.getThirdStageExecResult().isSuccess() && t.getFourthStageExecResult().isSuccess()) {
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(0);
} else {
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(0);
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(PROCESS_CNT);
}
int stageSuccessCount = 0;
int stageFailedCount = PROCESS_CNT;
if (t.getFirstStageExecResult().isSuccess()) {
stageSuccessCount += PROCESS_CNT;
if (t.getSecondStageExecResult().isSuccess()) {
stageSuccessCount += PROCESS_CNT;
if (t.getThirdStageExecResult().isSuccess()) {
stageSuccessCount += PROCESS_CNT;
if (t.getFourthStageExecResult().isSuccess()) {
stageSuccessCount += PROCESS_CNT;
stageFailedCount = 0;
}
}
}
}
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(stageSuccessCount);
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(stageFailedCount);
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineRunnerHighParallelismAsyncTest method test.
private void test(AsyncTestPipeline pipeline) {
String pipelineName = pipeline.pipelineName();
PipelineRunner pipelineRunner = pipeliteServices.runner().getPipelineRunner(pipelineName).get();
assertThat(pipelineRunner.getActiveProcessRunners().size()).isEqualTo(0);
PipelineMetrics pipelineMetrics = metrics.pipeline(pipelineName);
assertThat(pipelineMetrics.process().getInternalErrorCount()).isEqualTo(0);
// TODO: higher than expected completed count
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getFailedCount()).isZero();
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(0);
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(PROCESS_CNT);
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class ScheduleRunnerTest method assertSchedulerMetrics.
private void assertSchedulerMetrics(TestSchedule f) {
String pipelineName = f.pipelineName();
PipelineMetrics pipelineMetrics = metrics.pipeline(pipelineName);
TestProcessConfiguration t = f.getTestProcessConfiguration();
if (t.stageTestResult != StageTestResult.SUCCESS) {
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(t.stageExecCnt.get() / t.stageCnt);
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(t.stageExecCnt.get());
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(0L);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries())).isEqualTo(t.stageExecCnt.get() / t.stageCnt);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getFailedTimeSeries())).isEqualTo(t.stageExecCnt.get());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getSuccessTimeSeries())).isEqualTo(0);
} else {
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(t.stageExecCnt.get() / t.stageCnt);
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(0L);
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(t.stageExecCnt.get());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries())).isEqualTo(t.stageExecCnt.get() / t.stageCnt);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getFailedTimeSeries())).isEqualTo(0);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getSuccessTimeSeries())).isEqualTo(t.stageExecCnt.get());
}
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class ProcessRunnerPoolTest method testFailed.
@Test
public void testFailed() {
AtomicLong lockProcessCnt = new AtomicLong();
AtomicLong unlockProcessCnt = new AtomicLong();
ProcessRunnerPool pool = createProcessRunnerPool(lockProcessCnt, unlockProcessCnt);
AtomicInteger runProcessCnt = new AtomicInteger();
for (int i = 0; i < PROCESS_CNT; i++) {
Process process = createProcess((request) -> StageExecutorResult.error());
pool.runProcess(PIPELINE_NAME, process, (p) -> runProcessCnt.incrementAndGet());
}
while (!pool.isIdle()) {
Time.wait(Duration.ofSeconds(1));
pool.runOneIteration();
}
PipelineMetrics pipelineMetrics = metrics.pipeline(PIPELINE_NAME);
assertThat(runProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getCompletedCount()).isZero();
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getInternalErrorCount()).isZero();
assertThat(metrics.getProcessRunnerPoolOneIterationTimer().mean(TimeUnit.SECONDS)).isLessThan(5);
assertThat(metrics.getProcessRunnerOneIterationTimer().mean(TimeUnit.SECONDS)).isLessThan(5);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries())).isZero();
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries())).isEqualTo(PROCESS_CNT);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries(), ZonedDateTime.now().minusHours(1))).isEqualTo(PROCESS_CNT);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries(), ZonedDateTime.now().plusHours(1))).isZero();
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getInternalErrorTimeSeries())).isZero();
assertThat(lockProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(unlockProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(pool.getActiveProcessCount()).isZero();
assertThat(pool.getActiveProcessRunners().size()).isZero();
}
Aggregations