Search in sources :

Example 66 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldScheduleANewstageInALockedPipeline.

@Test
public void shouldScheduleANewstageInALockedPipeline() throws Exception {
    configFileHelper.lockPipeline(pipelineFixture.pipelineName);
    Pipeline pipeline = pipelineFixture.schedulePipeline();
    firstStagePassedAndSecondStageNotStarted(pipeline);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    schedulingChecker.canScheduleStage(pipeline.getIdentifier(), pipelineFixture.stageName(2), APPROVED_USER, result);
    assertThat(result.getServerHealthState().isSuccess(), is(true));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 67 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class SchedulingCheckerServiceIntegrationTest method shouldNotScheduleLockedPipelineIfAnyStageIsActiveInAnyPipeline.

@Test
public void shouldNotScheduleLockedPipelineIfAnyStageIsActiveInAnyPipeline() throws Exception {
    configFileHelper.lockPipeline(pipelineFixture.pipelineName);
    Pipeline pipeline = pipelineFixture.schedulePipeline();
    firstStagePassedAndSecondStageBuilding(pipeline);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    schedulingChecker.canTriggerManualPipeline(pipeline.getName(), APPROVED_USER, result);
    assertThat(result.getServerHealthState().isSuccess(), is(false));
    assertThat(result.getServerHealthState().getDescription(), containsString("is locked"));
    assertThat(result.getServerHealthState().getDescription(), containsString(pipeline.getName()));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 68 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class StageControllerIntegrationTest method shouldNotRunStageIfPreviousStageHasNotBeenRun.

@Test
public void shouldNotRunStageIfPreviousStageHasNotBeenRun() throws Exception {
    Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    String thirdStage = fixture.stageName(3);
    ModelAndView mav = controller.rerunStage(fixture.pipelineName, pipeline.getLabel(), thirdStage, response, request);
    Pipeline newPipeline = pipelineService.fullPipelineById(pipeline.getId());
    assertThat("Should not run " + thirdStage, newPipeline.getStages().hasStage(thirdStage), is(false));
    assertThat(((ResponseCodeView) mav.getView()).getStatusCode(), is(HttpServletResponse.SC_BAD_REQUEST));
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 69 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class StageControllerIntegrationTest method shouldReturn404WhenReRunningNonExistantStage.

@Test
public void shouldReturn404WhenReRunningNonExistantStage() throws Exception {
    Pipeline pipeline = fixture.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    ModelAndView mav = controller.rerunStage(fixture.pipelineName, pipeline.getLabel(), "doesNotExist", response, request);
    ResponseCodeView codeView = (ResponseCodeView) mav.getView();
    assertThat(codeView.getStatusCode(), is(HttpServletResponse.SC_NOT_FOUND));
    assertThat(codeView.getContent(), is("Stage 'doesNotExist' not found in pipeline '" + fixture.pipelineName + "'"));
}
Also used : ResponseCodeView(com.thoughtworks.go.server.web.ResponseCodeView) ModelAndView(org.springframework.web.servlet.ModelAndView) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 70 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class StageOrderTest method shouldKeepOrderForScheduledStage.

@Test
public void shouldKeepOrderForScheduledStage() throws Exception {
    schedulePipelineWithFirstStage();
    Pipeline pipeline = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
    dbHelper.passStage(pipeline.getFirstStage());
    Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
    scheduleService.rerunStage(mostRecent, preCondition.devStage(), "anyone");
    mostRecent = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
    assertThat(mostRecent.getFirstStage().getOrderId(), is(1000));
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)184 Test (org.junit.Test)122 Stage (com.thoughtworks.go.domain.Stage)33 Username (com.thoughtworks.go.server.domain.Username)30 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)29 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)24 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)24 PipelineMaterialRevision (com.thoughtworks.go.domain.PipelineMaterialRevision)21 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)20 JobInstance (com.thoughtworks.go.domain.JobInstance)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)13 Modification (com.thoughtworks.go.domain.materials.Modification)13 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)13 Date (java.util.Date)13 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)11 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)10 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6