Пример #1
0
 private void assertPipelineScheduled(PipelineConfig config) {
   Stage evolveStage =
       stageDao.mostRecentWithBuilds(
           CaseInsensitiveString.str(config.name()),
           config.findBy(new CaseInsensitiveString("dev")));
   assertThat(evolveStage.getName(), is("dev"));
   assertThat(evolveStage.getJobInstances().size(), is(1));
   assertThat(evolveStage.getJobInstances().first().getState(), is(JobState.Scheduled));
 }
Пример #2
0
  @Test
  public void shouldNotScheduleBuildIfNoModification() throws Exception {
    autoSchedulePipelines("mingle", "evolve");
    // Get the scheduled evolve stage and complete it.
    Stage evolveInstance =
        stageDao.mostRecentWithBuilds(
            CaseInsensitiveString.str(evolveConfig.name()),
            evolveConfig.findBy(new CaseInsensitiveString("dev")));
    dbHelper.passStage(evolveInstance);
    stageDao.stageStatusChanged(evolveInstance);

    autoSchedulePipelines();
    Stage mostRecent =
        stageDao.mostRecentWithBuilds(
            CaseInsensitiveString.str(evolveConfig.name()),
            evolveConfig.findBy(new CaseInsensitiveString("dev")));

    assertThat(mostRecent.getId(), is(evolveInstance.getId()));
    assertThat(mostRecent.getJobInstances().first().getState(), is(JobState.Completed));
  }
Пример #3
0
 private Pipeline passFirstStage(PipelineConfig pipelineConfig) {
   Stage completedMingleStage =
       stageDao.mostRecentWithBuilds(
           CaseInsensitiveString.str(pipelineConfig.name()),
           pipelineConfig.findBy(new CaseInsensitiveString("dev")));
   dbHelper.passStage(completedMingleStage);
   dbHelper.passStage(completedMingleStage);
   assertThat(completedMingleStage.getJobInstances().first().getState(), is(JobState.Completed));
   Pipeline pipeline =
       pipelineDao.mostRecentPipeline(CaseInsensitiveString.str(pipelineConfig.name()));
   return dbHelper.passPipeline(pipeline);
 }
Пример #4
0
  @Test
  public void shouldSaveBuildStateCorrectly() throws Exception {
    PipelineConfig cruisePlan = configHelper.addPipeline("cruise", "dev", repository);
    goConfigService.forceNotifyListeners();

    autoSchedulePipelines("mingle", "evolve", "cruise");

    Stage cruise =
        stageDao.mostRecentWithBuilds(
            CaseInsensitiveString.str(cruisePlan.name()),
            cruisePlan.findBy(new CaseInsensitiveString("dev")));
    System.out.println("cruise = " + cruise);
    JobInstance instance = cruise.getJobInstances().first();
    System.out.println("instance = " + instance);
    assertThat(instance.getState(), is(JobState.Scheduled));
  }