use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class ScheduleServiceStageTriggerTest method cancelCurrentStageShouldNotTriggerSameStageInMostRecentPipelineWhenItIsScheduledAlready.
@Test
public void cancelCurrentStageShouldNotTriggerSameStageInMostRecentPipelineWhenItIsScheduledAlready() throws Exception {
Pipeline oldest = preCondition.createPipelineWithFirstStagePassedAndSecondStageRunning();
preCondition.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
preCondition.createdPipelineWithAllStagesPassed();
long cancelledStageId = oldest.getStages().byName(preCondition.ftStage).getId();
scheduleService.cancelAndTriggerRelevantStages(cancelledStageId, null, null);
Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
Stage cancelledStage = stageService.stageById(cancelledStageId);
assertThat(cancelledStage.stageState(), is(StageState.Cancelled));
assertThat(mostRecent.getStages().byName(preCondition.ftStage).stageState(), is(StageState.Passed));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class ScheduleServiceStageTriggerTest method shouldNotRerunCurrentStageInNewerPipeline.
@Test
public void shouldNotRerunCurrentStageInNewerPipeline() throws Exception {
Pipeline olderPipeline = preCondition.createdPipelineWithAllStagesPassed();
Pipeline newerPipeline = preCondition.createdPipelineWithAllStagesPassed();
Stage oldFtStage = newerPipeline.getStages().byName(preCondition.ftStage);
schedulerFixture.rerunAndPassStage(olderPipeline, preCondition.ftStage());
Stage passedFtStage = pipelineService.fullPipelineById(olderPipeline.getId()).getStages().byName(preCondition.ftStage);
scheduleService.automaticallyTriggerRelevantStagesFollowingCompletionOf(passedFtStage);
Stage ftStage = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName).getStages().byName(preCondition.ftStage);
assertThat("Should not rerun ft in newer pipeline", ftStage.getId(), is(oldFtStage.getId()));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class ScheduleServiceStageTriggerTest method shouldNotTriggerNextStageFromConfigIfItIsScheduled.
@Test
public void shouldNotTriggerNextStageFromConfigIfItIsScheduled() throws Exception {
// having a pipeline with two stages both are completed
Pipeline pipeline = preCondition.createdPipelineWithAllStagesPassed();
Stage oldDevStage = pipeline.getStages().byName(preCondition.devStage);
// now we reorder the two stages via config from dev -> ft to ft -> dev
reOrderTwoStages();
// and then rerun the ftstage
schedulerFixture.rerunAndPassStage(pipeline, preCondition.ftStage());
// after ftStage passes, it should NOT trigger dev stage again otherwise this will
// ends up in a deadlock
Stage ftStage = stageDao.mostRecentWithBuilds(preCondition.pipelineName, preCondition.ftStage());
scheduleService.automaticallyTriggerRelevantStagesFollowingCompletionOf(ftStage);
// verifying that devStage is NOT rerun
Stage devStage = stageDao.mostRecentWithBuilds(preCondition.pipelineName, preCondition.devStage());
assertThat("Should not schedule dev stage again", devStage.getId(), is(oldDevStage.getId()));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class RestfulServiceTest method shouldTranslateLatestToRealStageCounter.
@Test
public void shouldTranslateLatestToRealStageCounter() throws Exception {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(pipeline.getName(), pipeline.getLabel(), fixture.devStage, JobIdentifier.LATEST, PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(Integer.valueOf(jobIdentifier.getStageCounter()), is(pipeline.getStages().byName(fixture.devStage).getCounter()));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class RestfulServiceTest method shouldTranslateLatestToRealPipelineLabel.
@Test
public void shouldTranslateLatestToRealPipelineLabel() throws Exception {
fixture.createdPipelineWithAllStagesPassed();
Pipeline latestPipleine = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(latestPipleine.getName(), JobIdentifier.LATEST, fixture.devStage, JobIdentifier.LATEST, PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(jobIdentifier.getPipelineLabel(), is(latestPipleine.getLabel()));
}
Aggregations