use of com.thoughtworks.go.config.CruiseConfig 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.config.CruiseConfig in project gocd by gocd.
the class HealthStateScopeTest method shouldRemoveScopeWhenJobIsRemovedFromConfig.
@Test
public void shouldRemoveScopeWhenJobIsRemovedFromConfig() throws Exception {
CruiseConfig config = GoConfigMother.pipelineHavingJob("blahPipeline", "blahStage", "blahJob", "fii", "baz");
assertThat(HealthStateScope.forJob("fooPipeline", "blahStage", "barJob").isRemovedFromConfig(config), is(true));
assertThat(HealthStateScope.forJob("blahPipeline", "blahStage", "blahJob").isRemovedFromConfig(config), is(false));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesNull.
@Test
public void shouldThrowExceptionWhenUserProvidesNull() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(null, SecurityConfigMother.securityConfigWithRole("role", "user")));
ArtifactDirValidator dirValidator = new ArtifactDirValidator();
try {
dirValidator.validate(cruiseConfig);
fail("should throw exception");
} catch (Exception e) {
}
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesEmtpty.
@Test
public void shouldThrowExceptionWhenUserProvidesEmtpty() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig("", null));
ArtifactDirValidator dirValidator = new ArtifactDirValidator();
try {
dirValidator.validate(cruiseConfig);
fail("should throw exception");
} catch (Exception e) {
}
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class ArtifactDirValidatorTest method shouldNotThrowExceptionWhenUserProvidesValidPath.
@Test
public void shouldNotThrowExceptionWhenUserProvidesValidPath() throws Exception {
File file = new File("");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(file.getAbsolutePath() + "/logs", null));
ArtifactDirValidator dirValidator = new ArtifactDirValidator();
dirValidator.validate(cruiseConfig);
}
Aggregations