use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingIfDiskSpaceIsFullForRerun.
@Test
public void shouldNotPassCheckingIfDiskSpaceIsFullForRerun() throws Exception {
String limit = diskSpaceSimulator.simulateDiskFull();
String pipelineName = pipelineFixture.pipelineName;
String label = "LATEST";
String stageName = CaseInsensitiveString.str(pipelineFixture.devStage().name());
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
configFileHelper.addAuthorizedUserForStage(pipelineName, stageName, APPROVED_USER);
assertThat(schedulingChecker.canScheduleStage(new PipelineIdentifier(pipelineName, 1, label), stageName, APPROVED_USER, result), is(false));
assertThat(result.getServerHealthState().getDescription(), containsString(String.format("GoCD has less than %sb of disk space", limit)));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingWhenUserHasNoPermissionForRerun.
@Test
public void shouldNotPassCheckingWhenUserHasNoPermissionForRerun() throws Exception {
Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.ftStage, "gli", result), is(false));
assertThat(result.getServerHealthState().getDescription(), containsString("does not have permission"));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldNotPassCheckingIfPipelineIsPausedForRerun.
@Test
public void shouldNotPassCheckingIfPipelineIsPausedForRerun() throws Exception {
Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
Username userName = new Username(new CaseInsensitiveString("A humble developer"));
configFileHelper.setOperatePermissionForGroup(pipelineFixture.groupName, userName.getUsername().toString(), APPROVED_USER);
pipelinePauseService.pause(pipeline.getName(), "Upgrade scheduled", userName);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.ftStage, APPROVED_USER, result), is(false));
assertThat(result.getServerHealthState().getDescription(), containsString(pipeline.getName() + " is paused"));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldReturnSuccessIfTheStageHasAllowOnlyOnSuccessUnSetAndPreviousStageFailed.
@Test
public void shouldReturnSuccessIfTheStageHasAllowOnlyOnSuccessUnSetAndPreviousStageFailed() {
configFileHelper.lockPipeline(pipelineFixture.pipelineName);
Pipeline pipeline = pipelineFixture.schedulePipeline();
firstStageFailedAndSecondStageNotStarted(pipeline);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.ftStage, APPROVED_USER, result);
ServerHealthState serverHealthState = result.getServerHealthState();
assertThat(serverHealthState.isSuccess(), is(true));
}
use of com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult in project gocd by gocd.
the class SchedulingCheckerServiceIntegrationTest method shouldFailCheckIfTheStageHasAllowOnlyOnSuccessSetAndPreviousStageFailed.
@Test
public void shouldFailCheckIfTheStageHasAllowOnlyOnSuccessSetAndPreviousStageFailed() {
configFileHelper.configureStageAsManualApproval(pipelineFixture.pipelineName, pipelineFixture.ftStage, true);
configFileHelper.addAuthorizedUserForStage(pipelineFixture.pipelineName, pipelineFixture.ftStage, APPROVED_USER);
configFileHelper.lockPipeline(pipelineFixture.pipelineName);
Pipeline pipeline = pipelineFixture.schedulePipeline();
firstStageFailedAndSecondStageNotStarted(pipeline);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.ftStage, APPROVED_USER, result);
ServerHealthState serverHealthState = result.getServerHealthState();
assertThat(serverHealthState.isSuccess(), is(false));
assertThat(serverHealthState.getDescription(), is("Cannot schedule ft as the previous stage dev has Failed!"));
assertThat(serverHealthState.getMessage(), is("Cannot schedule ft as the previous stage dev has Failed!"));
assertThat(serverHealthState.getType(), is(HealthStateType.forbidden()));
}
Aggregations