Search in sources :

Example 26 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class BuildCauseProducerServiceConfigRepoIntegrationTest method shouldNotSchedulePipelineWhenPartIsInvalid.

@Test
public void shouldNotSchedulePipelineWhenPartIsInvalid() throws Exception {
    configTestRepo.addCodeToRepositoryAndPush(fileName, "added broken config file", "bad bad config");
    materialUpdateService.updateMaterial(material);
    waitForMaterialNotInProgress();
    assertThat(goConfigRepoConfigDataSource.latestParseHasFailedForMaterial(material.config()), is(true));
    buildCauseProducerService.autoSchedulePipeline(PIPELINE_NAME, new ServerHealthStateOperationResult(), 123);
    scheduleHelper.waitForNotScheduled(5, PIPELINE_NAME);
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Example 27 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method shouldSchedulePipelineWithManualFirstStageWhenManuallyTriggered.

@Test
public void shouldSchedulePipelineWithManualFirstStageWhenManuallyTriggered() throws Exception {
    configHelper.configureStageAsManualApproval(MINGLE_PIPELINE_NAME, STAGE_NAME);
    svnRepository.checkInOneFile("a.java");
    materialDatabaseUpdater.updateMaterial(svnRepository.material());
    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    Map<CaseInsensitiveString, BuildCause> afterLoad = scheduleHelper.waitForAnyScheduled(5);
    assertThat(afterLoad.keySet(), hasItem(new CaseInsensitiveString(MINGLE_PIPELINE_NAME)));
    BuildCause cause = afterLoad.get(new CaseInsensitiveString(MINGLE_PIPELINE_NAME));
    assertThat(cause.getBuildCauseMessage(), containsString("Forced by anonymous"));
}
Also used : ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) HashMap(java.util.HashMap) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.jupiter.api.Test)

Example 28 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class DatabaseDiskSpaceFullTest method shouldNotRerunStageIfDiskspaceIsFull.

@Test
public void shouldNotRerunStageIfDiskspaceIsFull() throws Exception {
    Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), fixture.devStage, "anyone", result), is(false));
    assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), fixture.devStage, "anyone", new ServerHealthStateOperationResult()), is(false));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.jupiter.api.Test)

Example 29 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method shouldStopManualSchedulingIfDiskSpaceIsLessThanMinimum.

@Test
public void shouldStopManualSchedulingIfDiskSpaceIsLessThanMinimum() throws Exception {
    diskSpaceSimulator.simulateDiskFull();
    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(MINGLE_PIPELINE_NAME, Username.ANONYMOUS, new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    assertThat(serverHealthService.getLogsAsText(), containsString("GoCD Server has run out of artifacts disk space. Scheduling has been stopped"));
    assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), not(hasItem(new CaseInsensitiveString(MINGLE_PIPELINE_NAME))));
}
Also used : ScheduleOptions(com.thoughtworks.go.server.scheduling.ScheduleOptions) HashMap(java.util.HashMap) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 30 with ServerHealthStateOperationResult

use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.

the class PipelineActiveCheckerTest method shouldPassIfPipelineIsNotActive.

@Test
public void shouldPassIfPipelineIsNotActive() {
    when(service.isAnyStageActiveForPipeline(pipelineIdentifier)).thenReturn(false);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    checker.check(result);
    assertThat(result.getServerHealthState().isSuccess(), is(true));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Test(org.junit.jupiter.api.Test)

Aggregations

ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)89 Test (org.junit.jupiter.api.Test)78 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)28 ScheduleOptions (com.thoughtworks.go.server.scheduling.ScheduleOptions)17 HashMap (java.util.HashMap)17 Pipeline (com.thoughtworks.go.domain.Pipeline)16 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)15 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)12 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)12 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)11 Modification (com.thoughtworks.go.domain.materials.Modification)10 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)8 Username (com.thoughtworks.go.server.domain.Username)8 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)6 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)6 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)6 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)6 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)5 Materials (com.thoughtworks.go.config.materials.Materials)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)5