use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldNotSendMoreThanOneEmail.
@Test
public void shouldNotSendMoreThanOneEmail() {
CruiseConfig cruiseConfig = simulateFullDisk();
ArtifactsDiskSpaceFullChecker fullChecker = createChecker(cruiseConfig);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
fullChecker.check(result);
assertThat(result.canContinue(), is(false));
verify(sender).sendEmail(any(SendEmailMessage.class));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method simulateFullDisk.
private CruiseConfig simulateFullDisk() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT, "1200009M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
return cruiseConfig;
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldReturnTrueIfTheArtifactFolderHasSizeLimit.
@Test
public void shouldReturnTrueIfTheArtifactFolderHasSizeLimit() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT, "1M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
ArtifactsDiskSpaceFullChecker fullChecker = createChecker(cruiseConfig);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
fullChecker.check(result);
assertThat(result.canContinue(), is(true));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class DiskSpaceWarningCheckerTest method shouldUseWarningLimit.
@Test
public void shouldUseWarningLimit() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_WARNING_SIZE_LIMIT, "1M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
ArtifactsDiskSpaceWarningChecker fullChecker = new ArtifactsDiskSpaceWarningChecker(new SystemEnvironment(), sender, goConfigService, new SystemDiskSpaceChecker(), serverHealthService);
assertThat(fullChecker.limitInMb(), is(1L));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class HealthStateScopeTest method shouldRemoveScopeWhenStageIsRemovedFromConfig.
@Test
public void shouldRemoveScopeWhenStageIsRemovedFromConfig() throws Exception {
CruiseConfig config = GoConfigMother.pipelineHavingJob("blahPipeline", "blahStage", "blahJob", "fii", "baz");
assertThat(HealthStateScope.forPipeline("fooPipeline").isRemovedFromConfig(config), is(true));
assertThat(HealthStateScope.forPipeline("blahPipeline").isRemovedFromConfig(config), is(false));
assertThat(HealthStateScope.forStage("fooPipeline", "blahStage").isRemovedFromConfig(config), is(true));
assertThat(HealthStateScope.forStage("blahPipeline", "blahStageRemoved").isRemovedFromConfig(config), is(true));
assertThat(HealthStateScope.forStage("blahPipeline", "blahStage").isRemovedFromConfig(config), is(false));
}
Aggregations