Search in sources :

Example 1 with ArtifactsDiskIsFull

use of com.thoughtworks.go.fixture.ArtifactsDiskIsFull in project gocd by gocd.

the class GoDiskSpaceMonitorTest method shouldSendMailAboutArtifactsDiskSpaceFullErrorMessage.

@Test
public void shouldSendMailAboutArtifactsDiskSpaceFullErrorMessage() throws Exception {
    ArtifactsDiskIsFull full = new ArtifactsDiskIsFull();
    full.onSetUp();
    Mockito.when(mockDiskSpaceChecker.getUsableSpace(goConfigService.artifactsDir())).thenReturn(full.getLowLimit() - 1L);
    Mockito.when(mockDiskSpaceChecker.getUsableSpace(new File(SystemEnvironment.DB_BASE_DIR))).thenReturn(1000 * MEGA_BYTE);
    try {
        goDiskSpaceMonitor.onTimer();
        emailSender.assertHasMessageContaining("No artifacts disk space error message from Go Server");
    } finally {
        full.onTearDown();
    }
}
Also used : ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 2 with ArtifactsDiskIsFull

use of com.thoughtworks.go.fixture.ArtifactsDiskIsFull in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    goCache.clear();
    pipelineOne = new PipelineWithMultipleStages(3, materialRepository, transactionTemplate, temporaryFolder);
    pipelineOne.setGroupName("group1");
    pipelineTwo = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
    pipelineTwo.setGroupName("group2");
    diskIsFull = new ArtifactsDiskIsFull();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    dbHelper.onSetUp();
    pipelineOne.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    pipelineTwo.usingConfigHelper(configHelper).usingDbHelper(dbHelper).addToSetup();
    pipelineOne.configStageAsManualApprovalWithApprovedUsers(pipelineOne.stageName(2), "jez");
    configHelper.addSecurityWithAdminConfig();
    configHelper.setOperatePermissionForGroup("group1", "jez");
    pipelineCommentFeatureToggleState = featureToggleService.isToggleOn(Toggles.PIPELINE_COMMENT_FEATURE_TOGGLE_KEY);
    featureToggleService.changeValueOfToggle(Toggles.PIPELINE_COMMENT_FEATURE_TOGGLE_KEY, true);
    notifier.disableUpdates();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) Before(org.junit.Before)

Example 3 with ArtifactsDiskIsFull

use of com.thoughtworks.go.fixture.ArtifactsDiskIsFull in project gocd by gocd.

the class ArtifactsDiskSpaceFullCheckerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    goConfigService = mockGoConfigServiceToHaveSiteUrl();
    when(goConfigService.artifactsDir()).thenReturn(new File("."));
    emailSender = mock(EmailSender.class);
    checker = new ArtifactsDiskSpaceFullChecker(new SystemEnvironment(), emailSender, goConfigService, new SystemDiskSpaceChecker());
    full = new ArtifactsDiskIsFull();
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ArtifactsDiskIsFull

use of com.thoughtworks.go.fixture.ArtifactsDiskIsFull in project gocd by gocd.

the class AutoSchedulerIntegrationTest method shouldLogErrorIntoServerHealthServiceWhenArtifactsDiskSpaceIsFull.

@Test
public void shouldLogErrorIntoServerHealthServiceWhenArtifactsDiskSpaceIsFull() throws Exception {
    serverHealthService.removeAllLogs();
    ArtifactsDiskIsFull full = new ArtifactsDiskIsFull();
    full.onSetUp();
    if (!configService.artifactsDir().exists()) {
        configService.artifactsDir().createNewFile();
    }
    try {
        pipelineScheduler.onTimer();
        HealthStateType healthStateType = HealthStateType.artifactsDiskFull();
        assertThat(serverHealthService, containsState(healthStateType, HealthStateLevel.ERROR, "GoCD Server has run out of artifacts disk space. Scheduling has been stopped"));
    } finally {
        full.onTearDown();
        configService.artifactsDir().delete();
    }
}
Also used : ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) HealthStateType(com.thoughtworks.go.serverhealth.HealthStateType) Test(org.junit.jupiter.api.Test)

Example 5 with ArtifactsDiskIsFull

use of com.thoughtworks.go.fixture.ArtifactsDiskIsFull in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method setUp.

@BeforeEach
public void setUp(@TempDir Path tempDir) throws Exception {
    goCache.clear();
    pipelineOne = new PipelineWithMultipleStages(3, materialRepository, transactionTemplate, tempDir);
    pipelineOne.setGroupName("group1");
    pipelineTwo = new PipelineWithTwoStages(materialRepository, transactionTemplate, tempDir);
    pipelineTwo.setGroupName("group2");
    diskIsFull = new ArtifactsDiskIsFull();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    dbHelper.onSetUp();
    pipelineOne.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
    pipelineTwo.usingConfigHelper(configHelper).usingDbHelper(dbHelper).addToSetup();
    pipelineOne.configStageAsManualApprovalWithApprovedUsers(pipelineOne.stageName(2), "jez");
    configHelper.addSecurityWithAdminConfig();
    configHelper.setOperatePermissionForGroup("group1", "jez");
    notifier.disableUpdates();
}
Also used : PipelineWithTwoStages(com.thoughtworks.go.fixture.PipelineWithTwoStages) ArtifactsDiskIsFull(com.thoughtworks.go.fixture.ArtifactsDiskIsFull) PipelineWithMultipleStages(com.thoughtworks.go.fixture.PipelineWithMultipleStages) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ArtifactsDiskIsFull (com.thoughtworks.go.fixture.ArtifactsDiskIsFull)5 PipelineWithMultipleStages (com.thoughtworks.go.fixture.PipelineWithMultipleStages)2 PipelineWithTwoStages (com.thoughtworks.go.fixture.PipelineWithTwoStages)2 File (java.io.File)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 HealthStateType (com.thoughtworks.go.serverhealth.HealthStateType)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 Before (org.junit.Before)1