use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineScheduleQueueIntegrationTest method shouldPersistTriggerTimeEnvironmentVariable.
@Test
public void shouldPersistTriggerTimeEnvironmentVariable() {
PipelineConfig pipelineConfig = fixture.pipelineConfig();
pipelineConfig.setVariables(env("blahVariable", "blahValue"));
BuildCause cause = modifySomeFilesAndTriggerAs(pipelineConfig, "cruise-developer");
EnvironmentVariables environmentVariables = new EnvironmentVariables();
environmentVariables.add(new EnvironmentVariable("blahVariable", "blahOverride"));
cause.addOverriddenVariables(environmentVariables);
saveRev(cause);
queue.schedule(fixture.pipelineName, cause);
Pipeline pipeline = queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider());
assertThat(pipeline.scheduleTimeVariables(), is(new EnvironmentVariables(Arrays.asList(new EnvironmentVariable("blahVariable", "blahOverride")))));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineScheduleQueueIntegrationTest method shouldReturnNullIfBuildCauseIsTrumped.
@Test
public void shouldReturnNullIfBuildCauseIsTrumped() throws Exception {
PipelineConfig pipelineConfig = fixture.pipelineConfig();
BuildCause cause = modifySomeFiles(pipelineConfig, ModificationsMother.currentRevision());
queue.schedule(fixture.pipelineName, cause);
queue.finishSchedule(fixture.pipelineName, cause, cause);
assertThat(queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider()), is(nullValue()));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineScheduleQueueIntegrationTest method shouldBeCanceledWhenSameBuildCause.
@Test
public void shouldBeCanceledWhenSameBuildCause() throws Exception {
PipelineConfig pipelineConfig = fixture.pipelineConfig();
BuildCause cause = modifySomeFiles(pipelineConfig, ModificationsMother.currentRevision());
queue.finishSchedule(fixture.pipelineName, cause, cause);
queue.schedule(fixture.pipelineName, cause);
assertThat(fixture.pipelineName, is(scheduledOn(queue)));
assertThat(queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider()), is(nullValue()));
assertThat(fixture.pipelineName, is(not(scheduledOn(queue))));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineScheduleQueueIntegrationTest method shouldReturnNullWhenPipelineConfigOriginDoesNotMatchBuildCauseRevision.
@Test
public void shouldReturnNullWhenPipelineConfigOriginDoesNotMatchBuildCauseRevision() {
PipelineConfig pipelineConfig = fixture.pipelineConfig();
BuildCause cause = modifySomeFilesAndTriggerAs(pipelineConfig, "cruise-developer");
MaterialConfig materialConfig = pipelineConfig.materialConfigs().first();
cause.getMaterialRevisions().findRevisionFor(materialConfig);
pipelineConfig.setOrigins(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "123"), "plug"));
saveRev(cause);
queue.schedule(fixture.pipelineName, cause);
Pipeline pipeline = queue.createPipeline(cause, pipelineConfig, new DefaultSchedulingContext(cause.getApprover(), new Agents()), "md5-test", new TimeProvider());
assertThat(pipeline, is(nullValue()));
}
use of com.thoughtworks.go.domain.buildcause.BuildCause in project gocd by gocd.
the class PipelineScheduleQueueIntegrationTest method shouldReturnToBeScheduledBuildCauseIfExists.
@Test
public void shouldReturnToBeScheduledBuildCauseIfExists() {
BuildCause beforeSchedule = queue.toBeScheduled().get(fixture.pipelineName);
assertThat(beforeSchedule, is(nullValue()));
BuildCause buildCause = BuildCause.createWithEmptyModifications();
queue.schedule(fixture.pipelineName, buildCause);
BuildCause afterSchedule = queue.toBeScheduled().get(fixture.pipelineName);
assertThat(afterSchedule, is(buildCause));
}
Aggregations