Пример #1
0
  @Test
  public void
      shouldCollectPipelineNameConflictErrorsInTheChildren_InMergedConfig_WhenPipelinesIn2Groups() {
    BasicCruiseConfig mainCruiseConfig = GoConfigMother.configWithPipelines("pipeline-1");
    PartialConfig partialConfig = PartialConfigMother.withPipelineInGroup("pipeline-1", "g2");
    partialConfig.setOrigin(new RepoConfigOrigin());
    CruiseConfig config = new BasicCruiseConfig(mainCruiseConfig, partialConfig);

    List<ConfigErrors> allErrors = config.validateAfterPreprocess();
    assertThat(allErrors.size(), is(2));
    assertThat(
        allErrors.get(0).on("name"),
        is(
            "You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique."));
    assertThat(
        allErrors.get(1).on("name"),
        is(
            "You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique."));
  }
Пример #2
0
  @Test
  public void shouldCollectPipelineNameConflictErrorsInTheChildren_InMergedConfig_WhenCloned() {
    // we need this case because cloning has proven to be problematic with complex object graph in
    // merged config
    BasicCruiseConfig mainCruiseConfig = GoConfigMother.configWithPipelines("pipeline-1");
    PartialConfig partialConfig = PartialConfigMother.withPipelineInGroup("pipeline-1", "g2");
    partialConfig.setOrigin(new RepoConfigOrigin());
    CruiseConfig config = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
    Cloner CLONER = new Cloner();
    CruiseConfig cloned = CLONER.deepClone(config);

    List<ConfigErrors> allErrors = cloned.validateAfterPreprocess();
    assertThat(allErrors.size(), is(2));
    assertThat(
        allErrors.get(0).on("name"),
        is(
            "You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique."));
    assertThat(
        allErrors.get(1).on("name"),
        is(
            "You have defined multiple pipelines named 'pipeline-1'. Pipeline names must be unique."));
  }