use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class BuildCauseProducerServiceConfigRepoIntegrationTest method shouldSchedulePipelineWhenPartIsInvalid_AndManuallyTriggered.
@Test
public void shouldSchedulePipelineWhenPartIsInvalid_AndManuallyTriggered() throws Exception {
List<Modification> lastPush = configTestRepo.addCodeToRepositoryAndPush(fileName, "added broken config file", "bad bad config");
materialUpdateService.updateMaterial(material);
waitForMaterialNotInProgress();
assertThat(goConfigRepoConfigDataSource.latestParseHasFailedForMaterial(material.config()), is(true));
final HashMap<String, String> revisions = new HashMap<>();
final HashMap<String, String> environmentVariables = new HashMap<>();
buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
Map<CaseInsensitiveString, BuildCause> afterLoad = scheduleHelper.waitForAnyScheduled(5);
assertThat(afterLoad.keySet(), hasItem(new CaseInsensitiveString(PIPELINE_NAME)));
BuildCause cause = afterLoad.get(new CaseInsensitiveString(PIPELINE_NAME));
assertThat(cause.getBuildCauseMessage(), containsString("Forced by anonymous"));
PipelineConfig pipelineConfigAfterSchedule = goConfigService.pipelineConfigNamed(pipelineConfig.name());
RepoConfigOrigin configOriginAfterSchedule = (RepoConfigOrigin) pipelineConfigAfterSchedule.getOrigin();
String lastValidPushedRevision = this.firstRevisions.latestRevision();
assertThat("revisionOfPipelineConfigOriginShouldMatchLastValidPushedCommit", configOriginAfterSchedule.getRevision(), is(lastValidPushedRevision));
assertThat("buildCauseRevisionShouldMatchLastPushedCommit", cause.getMaterialRevisions().latestRevision(), is(lastPush.get(0).getRevision()));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method manualSchedulePipeline_canProduceShouldNotgetIntoCyclicLoopWithTriggerMonitor.
@Test
public void manualSchedulePipeline_canProduceShouldNotgetIntoCyclicLoopWithTriggerMonitor() throws Exception {
OperationResult operationResult = new ServerHealthStateOperationResult();
buildCauseProducer.manualProduceBuildCauseAndSave(MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(), operationResult);
scheduleHelper.waitForAnyScheduled(5);
assertThat(operationResult.canContinue(), is(true));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class MultipleMaterialsWithFilterTest method shouldNotTriggerPipelineWhenCheckinsAreIgnored.
@Test
public void shouldNotTriggerPipelineWhenCheckinsAreIgnored() throws Exception {
fixture.createPipelineHistory();
fixture.checkInToFirstMaterial("a.doc");
int size = pipelineScheduleQueue.toBeScheduled().size();
buildCauseProducerService.autoSchedulePipeline(fixture.pipelineName, new ServerHealthStateOperationResult(), 12345);
assertThat(pipelineScheduleQueue.toBeScheduled().size(), is(size));
assertThat(pipelineScheduleQueue.toBeScheduled().get(new CaseInsensitiveString(fixture.pipelineName)), is(nullValue()));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class MultipleMaterialsWithFilterTest method shouldUseLatestRevisionWhenAutoTriggered.
@Test
public void shouldUseLatestRevisionWhenAutoTriggered() throws Exception {
fixture.createPipelineHistory();
fixture.checkInToFirstMaterial("a.doc");
fixture.checkInToSecondMaterial("b.java");
buildCauseProducerService.autoSchedulePipeline(fixture.pipelineName, new ServerHealthStateOperationResult(), 12345);
BuildCause buildCause = pipelineScheduleQueue.toBeScheduled().get(new CaseInsensitiveString(fixture.pipelineName));
assertThat(buildCause, instanceOf(BuildCause.class));
MaterialRevisions actual = buildCause.getMaterialRevisions();
assertThat(actual.getMaterialRevision(fixture.getSecondMaterialFolder()).getRevision(), is(fixture.latestRevisionOfSecondMaterial().getRevision()));
assertThat(actual.getMaterialRevision(fixture.getFirstMaterialFolder()).getRevision(), is(fixture.latestRevisionOfFirstMaterial().getRevision()));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldPassCheckingWhenUserHasPermissionForRerun.
@Test
public void shouldPassCheckingWhenUserHasPermissionForRerun() throws Exception {
Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
assertTrue(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.ftStage, APPROVED_USER, new ServerHealthStateOperationResult()));
}
Aggregations