Search in sources :

Example 31 with GitTestRepo

use of com.thoughtworks.go.domain.materials.git.GitTestRepo in project gocd by gocd.

the class ScheduledPipelineLoaderIntegrationTest method shouldLoadShallowCloneFlagForGitMaterialsBaseOnTheirOwnPipelineConfig.

@Test
public void shouldLoadShallowCloneFlagForGitMaterialsBaseOnTheirOwnPipelineConfig(@TempDir Path tempDir) throws IOException {
    GitTestRepo testRepo = new GitTestRepo(tempDir);
    JobConfig jobConfig = new JobConfig("job-one");
    jobConfig.addTask(new AntTask());
    PipelineConfig shallowPipeline = PipelineConfigMother.pipelineConfig("shallowPipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(jobConfig)));
    shallowPipeline.materialConfigs().clear();
    shallowPipeline.addMaterialConfig(git(testRepo.projectRepositoryUrl(), true));
    configHelper.addPipeline(shallowPipeline);
    PipelineConfig fullPipeline = PipelineConfigMother.pipelineConfig("fullPipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(jobConfig)));
    fullPipeline.materialConfigs().clear();
    fullPipeline.addMaterialConfig(git(testRepo.projectRepositoryUrl(), false));
    configHelper.addPipeline(fullPipeline);
    Pipeline shallowPipelineInstance = createAndLoadModifyOneFilePipeline(shallowPipeline);
    MaterialRevisions shallowRevisions = shallowPipelineInstance.getBuildCause().getMaterialRevisions();
    assertThat(((GitMaterial) shallowRevisions.getRevisions().get(0).getMaterial()).isShallowClone(), is(true));
    Pipeline fullPipelineInstance = createAndLoadModifyOneFilePipeline(fullPipeline);
    MaterialRevisions fullRevisions = fullPipelineInstance.getBuildCause().getMaterialRevisions();
    assertThat(((GitMaterial) fullRevisions.getRevisions().get(0).getMaterial()).isShallowClone(), is(false));
}
Also used : GitTestRepo(com.thoughtworks.go.domain.materials.git.GitTestRepo) Test(org.junit.jupiter.api.Test)

Aggregations

GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)31 Test (org.junit.Test)20 RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)9 Modification (com.thoughtworks.go.domain.materials.Modification)8 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)7 File (java.io.File)7 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 Before (org.junit.Before)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)3 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)3 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)2 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)2 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)2 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)2 ScheduleOptions (com.thoughtworks.go.server.scheduling.ScheduleOptions)2 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)2 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)2