use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldReturnFalseIfTheArtifactFolderExceedSizeLimit.
@Test
public void shouldReturnFalseIfTheArtifactFolderExceedSizeLimit() {
CruiseConfig cruiseConfig = simulateFullDisk();
ArtifactsDiskSpaceFullChecker fullChecker = createChecker(cruiseConfig);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
fullChecker.check(result);
assertThat(result.getServerHealthState().isSuccess(), is(false));
assertThat(result.getServerHealthState().getMessage(), is("GoCD Server has run out of artifacts disk space. Scheduling has been stopped"));
assertThat(result.getServerHealthState().getType(), is(HealthStateType.artifactsDiskFull()));
verify(sender).sendEmail(any(SendEmailMessage.class));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class CompositeCheckerTest method shouldReturnErrorWhenWarningIsFollowedByError.
@Test
public void shouldReturnErrorWhenWarningIsFollowedByError() {
CompositeChecker checker = new CompositeChecker(StubCheckerFactory.warning(), StubCheckerFactory.error());
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState(), is(ERROR_SERVER_HEALTH_STATE));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class CompositeCheckerTest method shouldReturnWarningWhenOneCheckerIsWarning.
@Test
public void shouldReturnWarningWhenOneCheckerIsWarning() {
CompositeChecker checker = new CompositeChecker(StubCheckerFactory.warning(), StubCheckerFactory.successful());
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
checker.check(result);
assertThat(result.getServerHealthState(), is(WARNING_SERVER_HEALTH_STATE));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class DiskSpaceWarningCheckerTest method shouldShowAbsolutePathOfArtifactDirInWarningMessage.
// #2866
@Test
public void shouldShowAbsolutePathOfArtifactDirInWarningMessage() throws IOException, URISyntaxException {
goConfigService = mockGoConfigServiceToHaveSiteUrl();
TestingEmailSender sender = new TestingEmailSender();
SystemEnvironment systemEnvironment = new SystemEnvironment();
systemEnvironment.setProperty(SystemEnvironment.ARTIFACT_WARNING_SIZE_LIMIT, "1200009M");
ArtifactsDiskSpaceWarningChecker checker = new ArtifactsDiskSpaceWarningChecker(systemEnvironment, sender, goConfigService, new SystemDiskSpaceChecker(), serverHealthService);
checker.check(new ServerHealthStateOperationResult());
assertThat(sender.getSentMessage(), containsString(new File(".").getCanonicalPath()));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class BuildCauseProducerServiceConfigRepoIntegrationTest method shouldSchedulePipelineWhenManuallyTriggered.
@Test
public void shouldSchedulePipelineWhenManuallyTriggered() throws Exception {
configTestRepo.addCodeToRepositoryAndPush("a.java", "added code file", "some java code");
materialUpdateService.updateMaterial(material);
waitForMaterialNotInProgress();
final HashMap<String, String> revisions = new HashMap<>();
final HashMap<String, String> environmentVariables = new HashMap<>();
buildCauseProducer.manualProduceBuildCauseAndSave(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(PIPELINE_NAME)));
BuildCause cause = afterLoad.get(new CaseInsensitiveString(PIPELINE_NAME));
assertThat(cause.getBuildCauseMessage(), containsString("Forced by anonymous"));
}
Aggregations