use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class FetchTaskTest method validate_shouldNotErrorWhenReferencingConfigRepositoryPipelineFromConfigRepositoryPipeline.
@Test
public void validate_shouldNotErrorWhenReferencingConfigRepositoryPipelineFromConfigRepositoryPipeline() {
uppestStream.setOrigin(new RepoConfigOrigin());
downstream.setOrigin(new RepoConfigOrigin());
FetchTask task = new FetchTask(new CaseInsensitiveString("uppest_stream/upstream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "src", "dest");
task.validate(ConfigSaveValidationContext.forChain(config, new BasicPipelineConfigs(), downstream, downstream.getStage(new CaseInsensitiveString("stage"))));
assertThat(task.errors().isEmpty(), is(true));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class FetchTaskTest method validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline.
@Test
public void validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline() {
uppestStream.setOrigin(new FileConfigOrigin());
downstream.setOrigin(new RepoConfigOrigin());
FetchTask task = new FetchTask(new CaseInsensitiveString("uppest_stream/upstream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "src", "dest");
task.validate(ConfigSaveValidationContext.forChain(config, new BasicPipelineConfigs(), downstream, downstream.getStage(new CaseInsensitiveString("stage"))));
assertThat(task.errors().isEmpty(), is(true));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class FetchTaskTest method validate_shouldErrorWhenReferencingConfigRepositoryPipelineFromFilePipeline.
@Test
public void validate_shouldErrorWhenReferencingConfigRepositoryPipelineFromFilePipeline() {
uppestStream.setOrigin(new RepoConfigOrigin());
downstream.setOrigin(new FileConfigOrigin());
FetchTask task = new FetchTask(new CaseInsensitiveString("uppest_stream/upstream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "src", "dest");
StageConfig stage = downstream.getStage(new CaseInsensitiveString("stage"));
task.validate(ConfigSaveValidationContext.forChain(config, new BasicPipelineConfigs(), downstream, stage, stage.getJobs().first()));
assertThat(task.errors().isEmpty(), is(false));
assertThat(task.errors().on(FetchTask.ORIGIN), startsWith("\"downstream :: stage :: job\" tries to fetch artifact from job \"uppest_stream :: uppest-stage2 :: uppest-job2\" which is defined in"));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class GoFileConfigDataSourceIntegrationTest method shouldFallbackToValidPartialsForConfigChangesThroughFileSystem.
@Test
public void shouldFallbackToValidPartialsForConfigChangesThroughFileSystem() throws Exception {
assertThat(goConfigService.getCurrentConfig().getAllPipelineNames().contains(new CaseInsensitiveString(remoteDownstream)), is(true));
String remoteInvalidPipeline = "remote_invalid_pipeline";
PartialConfig invalidPartial = PartialConfigMother.invalidPartial(remoteInvalidPipeline, new RepoConfigOrigin(configRepo, "r2"));
goPartialConfig.onSuccessPartialConfig(configRepo, invalidPartial);
assertThat(goConfigService.getCurrentConfig().getAllPipelineNames().contains(new CaseInsensitiveString(remoteInvalidPipeline)), is(false));
final String newArtifactLocation = "some_random_change_to_config";
updateConfigOnFileSystem(new UpdateConfig() {
@Override
public void update(CruiseConfig cruiseConfig) {
cruiseConfig.server().setArtifactsDir(newArtifactLocation);
}
});
GoConfigHolder goConfigHolder = dataSource.forceLoad(new File(systemEnvironment.getCruiseConfigFile()));
assertThat(goConfigHolder.config.server().artifactsDir(), is(newArtifactLocation));
assertThat(goConfigHolder.config.getAllPipelineNames().contains(new CaseInsensitiveString(remoteDownstream)), is(true));
assertThat(goConfigHolder.config.getAllPipelineNames().contains(new CaseInsensitiveString(remoteInvalidPipeline)), is(false));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class GoFileConfigDataSourceTest method shouldReturnFalseWhenValidPartialsListIsNotTheSameAsKnownPartialList.
@Test
public void shouldReturnFalseWhenValidPartialsListIsNotTheSameAsKnownPartialList() {
PartialConfig partialConfig1 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "git_r1"));
PartialConfig partialConfig2 = PartialConfigMother.withPipeline("p2", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "svn_r1"));
PartialConfig partialConfig3 = PartialConfigMother.withPipeline("p1", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "git_r2"));
PartialConfig partialConfig4 = PartialConfigMother.withPipeline("p2", new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "svn_r2"));
List<PartialConfig> known = asList(partialConfig1, partialConfig2);
List<PartialConfig> valid = asList(partialConfig3, partialConfig4);
assertThat(dataSource.areKnownPartialsSameAsValidPartials(known, valid), is(false));
}
Aggregations