Пример #1
0
  private PipelineConfig replaceMaterialConfigForPipeline(
      String pipelinename, MaterialConfigs materialConfigs) {
    CruiseConfig cruiseConfig = loadForEdit();
    PipelineConfig pipelineConfig =
        cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelinename));
    pipelineConfig.setMaterialConfigs(materialConfigs);

    writeConfigFile(cruiseConfig);
    return pipelineConfig;
  }
 @Test
 public void shouldNotAssignWorkWhenPipelineScheduledWithStaleMaterials() {
   AgentIdentifier instance = agent(AgentMother.localAgent());
   Pipeline pipeline =
       instanceFactory.createPipelineInstance(
           evolveConfig,
           modifyNoFiles(evolveConfig),
           new DefaultSchedulingContext(DEFAULT_APPROVED_BY),
           md5,
           new TimeProvider());
   dbHelper.savePipelineWithStagesAndMaterials(pipeline);
   evolveConfig.setMaterialConfigs(new MaterialConfigs(new HgMaterialConfig("foo", null)));
   configHelper.removePipeline(CaseInsensitiveString.str(evolveConfig.name()));
   configHelper.addPipeline(evolveConfig);
   buildAssignmentService.onConfigChange(goConfigService.getCurrentConfig());
   JobInstance job = buildOf(pipeline);
   jobInstanceDao.updateStateAndResult(job);
   assertThat(
       buildAssignmentService.assignWorkToAgent(instance),
       is((Work) BuildAssignmentService.NO_WORK));
 }