예제 #1
0
  @Test
  public void shouldConsumeAllBuildCausesInServerHealth() throws Exception {
    pipelineScheduleQueue.schedule(
        "mingle", BuildCause.createManualForced(modifyOneFile(mingleConfig), Username.ANONYMOUS));
    pipelineScheduleQueue.schedule(
        "evolve", BuildCause.createManualForced(modifyOneFile(evolveConfig), Username.ANONYMOUS));

    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    assertThat(pipelineScheduleQueue.toBeScheduled().size(), is(0));
  }
예제 #2
0
  @Test
  public void shouldRemoveBuildCauseIfPipelineNotExist() throws Exception {
    configHelper.addPipeline("cruise", "dev", repository);
    goConfigService.forceNotifyListeners();
    scheduleHelper.autoSchedulePipelinesWithRealMaterials("mingle", "evolve", "cruise");

    Assertions.assertWillHappen(
        2,
        PipelineScheduleQueueMatcher.numberOfScheduledPipelinesIsAtLeast(pipelineScheduleQueue),
        Timeout.FIVE_SECONDS);
    int originalSize = pipelineScheduleQueue.toBeScheduled().size();
    assertThat(originalSize, greaterThan(1));
    configHelper.initializeConfigFile();
    goConfigService.forceNotifyListeners();

    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    assertThat(pipelineScheduleQueue.toBeScheduled().size(), is(0));
  }
예제 #3
0
 @After
 public void teardown() throws Exception {
   if (pipelineWithTwoStages != null) {
     pipelineWithTwoStages.onTearDown();
   }
   dbHelper.onTearDown();
   pipelineScheduleQueue.clear();
   testRepo.tearDown();
   FileUtil.deleteFolder(new File("pipelines"));
   configHelper.onTearDown();
 }
예제 #4
0
  @Test
  public void shouldRemoveBuildCauseIfAnyExceptionIsThrown() throws Exception {
    configHelper.addPipeline("cruise", "dev", repository);
    goConfigService.forceNotifyListeners();
    goConfigService
        .getCurrentConfig()
        .pipelineConfigByName(new CaseInsensitiveString("cruise"))
        .get(0)
        .jobConfigByConfigName(new CaseInsensitiveString("unit"))
        .setRunOnAllAgents(true);
    scheduleHelper.autoSchedulePipelinesWithRealMaterials("cruise");

    goConfigService.forceNotifyListeners();

    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    assertThat(pipelineScheduleQueue.toBeScheduled().size(), is(0));
  }