Search in sources :

Example 81 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldGetModificationsFrom1To1.

@Test
public void shouldGetModificationsFrom1To1() {
    Username loser = new Username(new CaseInsensitiveString("loser"));
    ManualBuild build = new ManualBuild(loser);
    Date checkinTime = new Date();
    Modification hgCommit1 = checkinWithComment("abcd", "#4518 - foo", checkinTime);
    Modification gitCommit1 = checkinWithComment("1234", "#3750 - agent index", checkinTime);
    Pipeline pipelineOne = dbHelper.checkinRevisionsToBuild(build, pipelineConfigWithTwoMaterials, dbHelper.addRevisionsWithModifications(hg, hgCommit1), dbHelper.addRevisionsWithModifications(git, gitCommit1));
    List<MaterialRevision> expectedRevisions = Arrays.asList(new MaterialRevision(hg, hgCommit1), new MaterialRevision(git, gitCommit1));
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> revisions = changesetService.revisionsBetween("foo", pipelineOne.getCounter(), pipelineOne.getCounter(), loser, result, true, false);
    assertMaterialRevisions(expectedRevisions, revisions);
    assertThat(result.isSuccessful(), is(true));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 82 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldGetModificationsFrom0To1.

@Test
public void shouldGetModificationsFrom0To1() {
    Username loser = new Username(new CaseInsensitiveString("loser"));
    ManualBuild build = new ManualBuild(loser);
    Date checkinTime = new Date();
    Modification hgCommit1 = checkinWithComment("abcd", "#4518 - foo", checkinTime);
    Modification gitCommit1 = checkinWithComment("1234", "#3750 - agent index", checkinTime);
    Pipeline pipelineOne = dbHelper.checkinRevisionsToBuild(build, pipelineConfigWithTwoMaterials, dbHelper.addRevisionsWithModifications(hg, hgCommit1), dbHelper.addRevisionsWithModifications(git, gitCommit1));
    List<MaterialRevision> expectedRevisions = Arrays.asList(new MaterialRevision(hg, hgCommit1), new MaterialRevision(git, gitCommit1));
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> revisions = changesetService.revisionsBetween("foo", 0, pipelineOne.getCounter(), loser, result, true, false);
    assertMaterialRevisions(expectedRevisions, revisions);
    assertThat(result.isSuccessful(), is(true));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 83 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldReturnModsOfItsOwnAndAnUpstreamPipelineForTheGivenPipelineCounters.

@Test
public void shouldReturnModsOfItsOwnAndAnUpstreamPipelineForTheGivenPipelineCounters() {
    PipelineConfig upstreamPipeline = configHelper.addPipeline("upstream", "stage", git.config(), "job");
    DependencyMaterial dependencyMaterial = MaterialsMother.dependencyMaterial("upstream", "stage");
    pipelineConfigWithTwoMaterials.addMaterialConfig(dependencyMaterial.config());
    pipelineConfigWithTwoMaterials.removeMaterialConfig(git.config());
    Username username = new Username(new CaseInsensitiveString("user1"));
    // Schedule upstream
    List<MaterialRevision> revisionsForUpstream1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream1, git);
    Pipeline upstreamOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream1);
    // Schedule downstream
    List<MaterialRevision> revisionsForPipeline1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForPipeline1, hg);
    dbHelper.addDependencyRevisionModification(revisionsForPipeline1, dependencyMaterial, upstreamOne);
    Pipeline pipelineOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForPipeline1);
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> actual = changesetService.revisionsBetween(CaseInsensitiveString.str(pipelineConfigWithTwoMaterials.name()), pipelineOne.getCounter(), pipelineOne.getCounter(), username, result, true, false);
    List<MaterialRevision> expectedRevisions = groupByMaterial(revisionsForUpstream1, revisionsForPipeline1);
    assertMaterialRevisions(expectedRevisions, actual);
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 84 with Pipeline

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

the class ChangesetServiceIntegrationTest method shouldReturn_SCMMods_AcrossParentStageFailures_WithFailuresNextToFrom.

@Test
public void shouldReturn_SCMMods_AcrossParentStageFailures_WithFailuresNextToFrom() {
    PipelineConfig upstreamPipeline = configHelper.addPipeline("upstream", "stage", git.config(), "job");
    DependencyMaterial dependencyMaterial = MaterialsMother.dependencyMaterial("upstream", "stage");
    pipelineConfigWithTwoMaterials.addMaterialConfig(dependencyMaterial.config());
    pipelineConfigWithTwoMaterials.removeMaterialConfig(git.config());
    Username username = new Username(new CaseInsensitiveString("user1"));
    // Schedule first of upstream
    List<MaterialRevision> revisionsForUpstream1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream1, git);
    Pipeline upstreamOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream1);
    // Schedule downstream
    List<MaterialRevision> revisionsForDownstream1 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForDownstream1, hg);
    dbHelper.addDependencyRevisionModification(revisionsForDownstream1, dependencyMaterial, upstreamOne);
    Pipeline downstreamOne = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForDownstream1);
    // Schedule multiple upstream, but no corresponding downstream, because upstream stage failed(may be?)
    List<MaterialRevision> revisionsForUpstream2 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream2, git);
    Pipeline upstreamTwo = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream2);
    List<MaterialRevision> revisionsForUpstream3 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream3, git);
    Pipeline upstreamThree = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream3);
    // Schedule upstream again(upstream stage starts passing once again)
    List<MaterialRevision> revisionsForUpstream4 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForUpstream4, git);
    Pipeline upstreamFour = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), upstreamPipeline, revisionsForUpstream4);
    // Schedule downstream for comparision
    List<MaterialRevision> revisionsForDownstream2 = new ArrayList<>();
    addRevisionWith2Mods(revisionsForDownstream2, hg);
    dbHelper.addDependencyRevisionModification(revisionsForDownstream2, dependencyMaterial, upstreamFour);
    Pipeline downstreamTwo = dbHelper.checkinRevisionsToBuild(new ManualBuild(username), pipelineConfigWithTwoMaterials, revisionsForDownstream2);
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    List<MaterialRevision> actual = changesetService.revisionsBetween(CaseInsensitiveString.str(pipelineConfigWithTwoMaterials.name()), downstreamOne.getCounter(), downstreamTwo.getCounter(), username, result, true, false);
    List<MaterialRevision> expectedRevisions = groupByMaterial(revisionsForUpstream2, revisionsForUpstream3, revisionsForUpstream4, revisionsForDownstream2);
    assertMaterialRevisions(expectedRevisions, actual);
    assertThat(result.isSuccessful(), is(true));
    actual = changesetService.revisionsBetween(CaseInsensitiveString.str(pipelineConfigWithTwoMaterials.name()), downstreamTwo.getCounter(), downstreamTwo.getCounter(), username, result, true, // same to and from
    false);
    assertMaterialRevisions(expectedRevisions, actual);
    assertThat(result.isSuccessful(), is(true));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PipelineMaterialRevision(com.thoughtworks.go.domain.PipelineMaterialRevision) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 85 with Pipeline

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

the class DatabaseDiskSpaceFullTest method shouldNotRerunStageIfDiskspaceIsFull.

@Test
public void shouldNotRerunStageIfDiskspaceIsFull() throws Exception {
    Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), fixture.devStage, "anyone", result), is(false));
    assertThat(schedulingChecker.canScheduleStage(pipeline.getIdentifier(), fixture.devStage, "anyone", new ServerHealthStateOperationResult()), is(false));
}
Also used : ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) 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