use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testUpdateWithRunSids.
@Test
public void testUpdateWithRunSids() {
List<RunSid> runSids = new ArrayList<>();
RunSid runSid1 = new RunSid();
runSid1.setName(TEST_USER);
runSid1.setIsPrincipal(true);
runSids.add(runSid1);
RunSid runSid2 = new RunSid();
runSid2.setName(GROUP_NAME);
runSid2.setIsPrincipal(false);
Pipeline testPipeline = getPipeline();
PipelineRun run = createRunWithRunSids(testPipeline.getId(), null, runSids);
pipelineRunDao.deleteRunSids(run.getId());
PipelineRun loadedRuns = pipelineRunDao.loadPipelineRun(run.getId());
assertTrue(loadedRuns.getRunSids().isEmpty());
runSids.add(runSid2);
pipelineRunDao.createRunSids(run.getId(), runSids);
loadedRuns = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(2, loadedRuns.getRunSids().size());
assertTrue(runSids.equals(loadedRuns.getRunSids()));
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method updateRunCommitStatus.
@Test
public void updateRunCommitStatus() {
PipelineRun run = createTestPipelineRun();
run.setCommitStatus(CommitStatus.SUCCESS);
pipelineRunDao.updateRunCommitStatus(run);
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(run.getCommitStatus(), loadedRun.getCommitStatus());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method updateProlongedAtTimeTest.
@Test
public void updateProlongedAtTimeTest() {
PipelineRun run = createTestPipelineRun();
LocalDateTime time = DateUtils.nowUTC();
PipelineRun loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertNull(loadedRun.getProlongedAtTime());
run.setProlongedAtTime(time);
pipelineRunDao.updateProlongIdleRunAndLastIdleNotificationTime(run);
loadedRun = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(time, loadedRun.getProlongedAtTime());
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method loadRunningPipelineRuns.
@Test
public void loadRunningPipelineRuns() {
PipelineRun run = createTestPipelineRun();
List<PipelineRun> running = pipelineRunDao.loadRunningAndTerminatedPipelineRuns();
assertFalse(running.isEmpty());
assertTrue(running.stream().anyMatch(r -> Objects.equals(r.getId(), run.getId())));
run.setStatus(TaskStatus.FAILURE);
run.setTerminating(true);
pipelineRunDao.updateRunStatus(run);
List<PipelineRun> terminating = pipelineRunDao.loadRunningAndTerminatedPipelineRuns();
assertFalse(terminating.isEmpty());
assertFalse(terminating.stream().anyMatch(r -> r.getStatus() == TaskStatus.RUNNING));
assertTrue(terminating.stream().anyMatch(r -> Objects.equals(r.getId(), run.getId())));
}
use of com.epam.pipeline.entity.pipeline.PipelineRun in project cloud-pipeline by epam.
the class PipelineRunDaoTest method testLoadRunWithPricePerHour.
@Test
public void testLoadRunWithPricePerHour() {
PipelineRun run = createTestPipelineRun(testPipeline.getId());
run.setPricePerHour(PRICE_PER_HOUR);
pipelineRunDao.updateRun(run);
PipelineRun loaded = pipelineRunDao.loadPipelineRun(run.getId());
assertEquals(run.getId(), loaded.getId());
assertEquals(PRICE_PER_HOUR, loaded.getPricePerHour());
}
Aggregations