Search in sources :

Example 56 with CruiseConfig

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));
}
Also used : SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 57 with CruiseConfig

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;
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig)

Example 58 with 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));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 59 with CruiseConfig

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));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 60 with CruiseConfig

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));
}
Also used : CruiseConfig(com.thoughtworks.go.config.CruiseConfig) Test(org.junit.Test)

Aggregations

CruiseConfig (com.thoughtworks.go.config.CruiseConfig)95 Test (org.junit.Test)77 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)54 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)35 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)33 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)32 ServerConfig (com.thoughtworks.go.config.ServerConfig)11 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)5 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)5 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)4 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 ServerSiteUrlConfig (com.thoughtworks.go.domain.ServerSiteUrlConfig)4 File (java.io.File)4 ConfigCache (com.thoughtworks.go.config.ConfigCache)3 GoConfigDao (com.thoughtworks.go.config.GoConfigDao)3 MagicalGoConfigXmlLoader (com.thoughtworks.go.config.MagicalGoConfigXmlLoader)3 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)3 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)3