use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class BuildAssignmentServiceTest method shouldMatchAnElasticJobToAnElasticAgentOnlyIfThePluginAgreesToTheAssignmentWhenMultipleElasticJobsRequiringTheSamePluginAreScheduled.
@Test
public void shouldMatchAnElasticJobToAnElasticAgentOnlyIfThePluginAgreesToTheAssignmentWhenMultipleElasticJobsRequiringTheSamePluginAreScheduled() {
PipelineConfig pipelineWith2ElasticJobs = PipelineConfigMother.pipelineWithElasticJob(elasticProfileId1, elasticProfileId2);
JobPlan jobPlan1 = new InstanceFactory().createJobPlan(pipelineWith2ElasticJobs.first().getJobs().first(), schedulingContext);
JobPlan jobPlan2 = new InstanceFactory().createJobPlan(pipelineWith2ElasticJobs.first().getJobs().last(), schedulingContext);
jobPlans.add(jobPlan1);
jobPlans.add(jobPlan2);
when(elasticAgentPluginService.shouldAssignWork(elasticAgentInstance.elasticAgentMetadata(), "", jobPlan1.getElasticProfile(), jobPlan1.getIdentifier())).thenReturn(false);
when(elasticAgentPluginService.shouldAssignWork(elasticAgentInstance.elasticAgentMetadata(), "", jobPlan2.getElasticProfile(), jobPlan2.getIdentifier())).thenReturn(true);
buildAssignmentService.onTimer();
JobPlan matchingJob = buildAssignmentService.findMatchingJob(elasticAgentInstance);
assertThat(matchingJob, is(jobPlan2));
assertThat(buildAssignmentService.jobPlans().size(), is(1));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class BuildAssignmentServiceTest method shouldMatchAnElasticJobToAnElasticAgentOnlyIfThePluginAgreesToTheAssignment.
@Test
public void shouldMatchAnElasticJobToAnElasticAgentOnlyIfThePluginAgreesToTheAssignment() {
PipelineConfig pipelineWithElasticJob = PipelineConfigMother.pipelineWithElasticJob(elasticProfileId1);
JobPlan jobPlan = new InstanceFactory().createJobPlan(pipelineWithElasticJob.first().getJobs().first(), schedulingContext);
jobPlans.add(jobPlan);
when(elasticAgentPluginService.shouldAssignWork(elasticAgentInstance.elasticAgentMetadata(), "", jobPlan.getElasticProfile(), jobPlan.getIdentifier())).thenReturn(true);
buildAssignmentService.onTimer();
JobPlan matchingJob = buildAssignmentService.findMatchingJob(elasticAgentInstance);
assertThat(matchingJob, is(jobPlan));
assertThat(buildAssignmentService.jobPlans().size(), is(0));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class EntityHashingServiceTest method shouldInvalidatePipelineConfigEtagsFromCacheOnPipelineChange.
@Test
public void shouldInvalidatePipelineConfigEtagsFromCacheOnPipelineChange() {
EntityHashingService.PipelineConfigChangedListener listener = entityHashingService.new PipelineConfigChangedListener();
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("P1");
listener.onEntityConfigChange(pipelineConfig);
verify(goCache).remove("GO_ETAG_CACHE", (pipelineConfig.getClass().getName() + "." + "p1"));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class EntityHashingServiceTest method shouldComputeTheMD5OfAGivenXmlPartialGeneratedFromAnObject.
@Test
public void shouldComputeTheMD5OfAGivenXmlPartialGeneratedFromAnObject() {
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("P1");
String xml = new MagicalGoConfigXmlWriter(configCache, registry).toXmlPartial(pipelineConfig);
assertThat(entityHashingService.md5ForEntity(pipelineConfig), is(CachedDigestUtils.md5Hex(xml)));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class JobInstanceStatusMonitorTest method setUp.
@Before
public void setUp() throws Exception {
configHelper = new GoConfigFileHelper().usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
dbHelper.onSetUp();
fixture = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
fixture.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
repository = new SvnCommand(null, testRepo.projectRepositoryUrl());
PipelineConfig evolveConfig = configHelper.addPipeline("evolve", STAGE_NAME, repository, "unit");
configHelper.addPipeline("anotherPipeline", STAGE_NAME, repository, "anotherTest");
configHelper.addPipeline("thirdPipeline", STAGE_NAME, repository, "yetAnotherTest");
goConfigService.forceNotifyListeners();
goCache.clear();
agent = new AgentStub();
}
Aggregations