use of com.thoughtworks.go.server.scheduling.ScheduleOptions 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(goRepoConfigDataSource.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<String, BuildCause> afterLoad = scheduleHelper.waitForAnyScheduled(5);
assertThat(afterLoad.keySet(), hasItem(PIPELINE_NAME));
BuildCause cause = afterLoad.get(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.scheduling.ScheduleOptions in project gocd by gocd.
the class BuildCauseProducerServiceIntegrationTest method shouldScheduleANewPipelineWhenManuallyTrigeredWithNoChanges.
@Test
public void shouldScheduleANewPipelineWhenManuallyTrigeredWithNoChanges() throws Exception {
final HashMap<String, String> revisions = new HashMap<>();
final HashMap<String, String> environmentVariables = new HashMap<>();
buildCauseProducer.manualProduceBuildCauseAndSave(MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
assertThat(scheduleHelper.waitForAnyScheduled(5).keySet(), hasItem(MINGLE_PIPELINE_NAME));
}
use of com.thoughtworks.go.server.scheduling.ScheduleOptions 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.scheduling.ScheduleOptions in project gocd by gocd.
the class BuildCauseProducerServiceWithFlipModificationTest method shouldHaveModificationChangedAsFalseWhenForceBuildWithoutModification.
@Test
public void shouldHaveModificationChangedAsFalseWhenForceBuildWithoutModification() throws Exception {
mingleConfig = configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME, svnMaterialConfig, "unit", "functional");
consume(buildCause());
final HashMap<String, String> revisions = new HashMap<>();
final HashMap<String, String> environmentVariables = new HashMap<>();
buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, new Username(new CaseInsensitiveString("pavan")), new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
verifyBuildCauseHasModificationsWith(pipelineScheduleQueue.toBeScheduled(), false);
}
use of com.thoughtworks.go.server.scheduling.ScheduleOptions in project gocd by gocd.
the class BuildCauseProducerServiceWithFlipModificationTest method shouldHaveModificationChangedAsTrueForNewRevisions.
@Test
public void shouldHaveModificationChangedAsTrueForNewRevisions() throws Exception {
mingleConfig = configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME, svnMaterialConfig, "unit", "functional");
consume(buildCause());
svnRepository.checkInOneFile("abc");
final HashMap<String, String> revisions = new HashMap<>();
final HashMap<String, String> environmentVariables = new HashMap<>();
buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, new Username(new CaseInsensitiveString("pavan")), new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
verifyBuildCauseHasModificationsWith(pipelineScheduleQueue.toBeScheduled(), true);
}
Aggregations