Exemplo n.º 1
0
 @Test
 public void shouldReturnTrueForPipelineThatInFirstGroup_WhenFirstGroupIsLocal() {
   PipelineConfigs group1 = createGroup("group1", createPipelineConfig("pipeline1", "stage1"));
   CruiseConfig config = new BasicCruiseConfig(new BasicCruiseConfig(group1), new PartialConfig());
   assertThat(
       "shouldReturnTrueForPipelineThatInFirstGroup",
       config.isInFirstGroup(new CaseInsensitiveString("pipeline1")),
       is(true));
 }
Exemplo n.º 2
0
 @Test
 public void shouldReturnTrueForPipelineThatInFirstGroup_WhenFirstGroupIsRemote() {
   CruiseConfig config =
       new BasicCruiseConfig(
           new BasicCruiseConfig(),
           PartialConfigMother.withPipelineInGroup("remote-pipe-1", "remote_group"));
   assertThat(
       "shouldReturnTrueForPipelineThatInFirstGroup",
       config.isInFirstGroup(new CaseInsensitiveString("remote-pipe-1")),
       is(true));
 }
Exemplo n.º 3
0
 @Test
 public void shouldReturnFalseForPipelineThatNotInFirstGroup_WhenSecondGroupIsRemote() {
   PipelineConfigs group1 = createGroup("group1", createPipelineConfig("pipeline1", "stage1"));
   CruiseConfig config =
       new BasicCruiseConfig(
           new BasicCruiseConfig(group1),
           PartialConfigMother.withPipelineInGroup("remote-pipe-1", "remote_group"));
   assertThat(
       "shouldReturnFalseForPipelineThatNotInFirstGroup",
       config.isInFirstGroup(new CaseInsensitiveString("pipeline2")),
       is(false));
 }
Exemplo n.º 4
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."));
  }
Exemplo n.º 5
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."));
  }