use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class ConfigRepoServiceIntegrationTest method shouldDeleteSpecifiedConfigRepository.
@Test
public void shouldDeleteSpecifiedConfigRepository() throws Exception {
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
configHelper.enableSecurity();
goConfigDao.updateConfig(new UpdateConfigCommand() {
@Override
public CruiseConfig update(CruiseConfig cruiseConfig) throws Exception {
cruiseConfig.getConfigRepos().add(configRepo);
return cruiseConfig;
}
});
assertThat(configRepoService.getConfigRepo(repoId), is(configRepo));
configRepoService.deleteConfigRepo(repoId, user, result);
assertNull(configRepoService.getConfigRepo(repoId));
assertThat(result.toString(), result.isSuccessful(), Is.is(true));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class FaninDependencyResolutionTest method shouldConsiderFailedBuildOfRootNodeForFinalRevisionComputation.
@Test
public void shouldConsiderFailedBuildOfRootNodeForFinalRevisionComputation() {
/*
+---> P1 ---+
| v
git-------> P2
*/
int i = 1;
GitMaterial git1 = u.wf(new GitMaterial("git1"), "folder");
String[] git_revs1 = { "g11", "g12", "g13" };
u.checkinInOrder(git1, u.d(i++), git_revs1);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(git1));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(git1), u.m(p1));
CruiseConfig cruiseConfig = goConfigDao.load();
String p1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g11");
String p2_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p2, u.d(i++), "g11", p1_1);
String p1_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g12");
String p2_2 = u.runAndFail(p2, u.d(i++), "g12", p1_2);
String p1_3 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(p1, u.d(i++), "g13");
MaterialRevisions given = u.mrs(u.mr(p1, true, p1_3), u.mr(git1, true, "g13"));
assertThat(getRevisionsBasedOnDependencies(p2, cruiseConfig, given), is(given));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class FaninDependencyResolutionTest method shouldTriggerCommonCIAndCDPhasesCorrectly_FAILING_SCN.
@Test
public void shouldTriggerCommonCIAndCDPhasesCorrectly_FAILING_SCN() throws Exception {
// -----> Acceptance ----
// | | v
// Build | Staging ---> Production
// | v ^
// ----->Regression ----
//
GitMaterial git = u.wf(new GitMaterial("git"), "folder1");
u.checkinInOrder(git, "g1", "g2", "g3");
ScheduleTestUtil.AddedPipeline build = u.saveConfigWith("build", u.m(git));
ScheduleTestUtil.AddedPipeline acceptance = u.saveConfigWith("acceptance", u.m(build));
ScheduleTestUtil.AddedPipeline regression = u.saveConfigWith("regression", u.m(build), u.m(acceptance));
ScheduleTestUtil.AddedPipeline staging = u.saveConfigWith("staging", u.m(acceptance), u.m(regression));
ScheduleTestUtil.AddedPipeline production = u.saveConfigWith("production", u.m(staging));
CruiseConfig cruiseConfig = goConfigDao.load();
int i = 1;
String b_1 = u.runAndPass(build, "g1");
String a_1 = u.runAndPass(acceptance, b_1);
String r_1 = u.runAndPass(regression, b_1, a_1);
String s_1 = u.runAndPass(staging, a_1, r_1);
String p_1 = u.runAndPass(production, s_1);
String b_2 = u.runAndPass(build, "g2");
MaterialRevisions given = u.mrs(u.mr(build, true, b_2), u.mr(acceptance, false, a_1));
MaterialRevisions expected = u.mrs(u.mr(build, true, b_1), u.mr(acceptance, false, a_1));
assertThat(getRevisionsBasedOnDependencies(regression, cruiseConfig, given), is(expected));
String a_2 = u.runAndPass(acceptance, b_2);
given = u.mrs(u.mr(build, true, b_2), u.mr(acceptance, false, a_2));
expected = u.mrs(u.mr(build, true, b_2), u.mr(acceptance, true, a_2));
assertThat(getRevisionsBasedOnDependencies(regression, cruiseConfig, given), is(expected));
String r_2 = u.runAndPass(regression, b_2, a_2);
String r_3 = u.runAndPass(regression, b_1, a_2);
given = u.mrs(u.mr(acceptance, true, a_2), u.mr(regression, true, r_3));
expected = u.mrs(u.mr(acceptance, true, a_2), u.mr(regression, true, r_2));
assertThat(getRevisionsBasedOnDependencies(staging, cruiseConfig, given), is(expected));
String s_2 = u.runAndPass(staging, a_2, r_2);
String s_3 = u.runAndPass(staging, a_2, r_3);
given = u.mrs(u.mr(staging, true, s_3));
expected = u.mrs(u.mr(staging, true, s_2));
assertThat(getRevisionsBasedOnDependencies(production, cruiseConfig, given), is(expected));
String b_3 = u.runAndPass(build, "g3");
String a_3 = u.runAndPass(acceptance, b_3);
String r_4 = u.runAndPass(regression, b_3, a_3);
String s_4 = u.runAndPass(staging, a_3, r_1);
String s_5 = u.runAndPass(staging, a_1, r_4);
given = u.mrs(u.mr(acceptance, true, a_3), u.mr(regression, true, r_4));
expected = u.mrs(u.mr(acceptance, true, a_3), u.mr(regression, true, r_4));
MaterialRevisions previousMaterialRevisions = u.mrs(u.mr(acceptance, false, a_1), u.mr(regression, false, r_4));
assertThat(getRevisionsBasedOnDependencies(staging, cruiseConfig, given), is(expected));
// assertThat(getBuildCause(staging,given,previousMaterialRevisions), is(not(nullValue()))); //TODO: *************** Bug where pipeline should be triggered <Sara>
String r_5 = u.runAndPass(regression, b_3, a_3);
given = u.mrs(u.mr(acceptance, true, a_3), u.mr(regression, true, r_5));
expected = u.mrs(u.mr(acceptance, true, a_3), u.mr(regression, true, r_5));
assertThat(getRevisionsBasedOnDependencies(staging, cruiseConfig, given), is(expected));
previousMaterialRevisions = u.mrs(u.mr(acceptance, false, a_1), u.mr(regression, false, r_4));
assertThat(getBuildCause(staging, given, previousMaterialRevisions).getMaterialRevisions(), is(expected));
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class MaterialUpdateServiceIntegrationTest method configWithMaterial.
private CruiseConfig configWithMaterial(SvnMaterialConfig goodMaterial) {
CruiseConfig config = new BasicCruiseConfig();
new GoConfigMother().addPipeline(config, "good-pipeline", "first-stage", new MaterialConfigs(goodMaterial));
return config;
}
use of com.thoughtworks.go.config.CruiseConfig in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldTwistFaninBehaviourWithDifferentConfiguration.
@Test
public void shouldTwistFaninBehaviourWithDifferentConfiguration() {
int i = 1;
GitMaterial git1 = u.wf(new GitMaterial("git1"), "folder1");
String[] git_revs1 = { "g11" };
u.checkinInOrder(git1, u.d(i++), git_revs1);
GitMaterial git2 = u.wf(new GitMaterial("git2"), "folder2");
String[] git_revs2 = { "g21", "g22" };
u.checkinInOrder(git2, u.d(i++), git_revs2);
ScheduleTestUtil.AddedPipeline c1 = u.saveConfigWith("c1", u.m(git1), u.m(git2));
ScheduleTestUtil.AddedPipeline c2 = u.saveConfigWith("c2", u.m(git1));
ScheduleTestUtil.AddedPipeline c3 = u.saveConfigWith("c3", u.m(git1), u.m(c1), u.m(c2));
ScheduleTestUtil.AddedPipeline c4 = u.saveConfigWith("c4", u.m(c1), u.m(c2), u.m(c3));
ScheduleTestUtil.AddedPipeline c5 = u.saveConfigWith("c5", u.m(git2));
ScheduleTestUtil.AddedPipeline c6 = u.saveConfigWith("c6", u.m(git1), u.m(c1), u.m(c4), u.m(c5));
CruiseConfig cruiseConfig = goConfigDao.load();
String c1_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c1, u.d(i++), "g11", "g21");
String c2_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c2, u.d(i++), "g11");
String c3_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c3, u.d(i++), "g11", c1_1, c2_1);
String c4_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c4, u.d(i++), c1_1, c2_1, c3_1);
String c5_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c5, u.d(i++), "g21");
String c6_1 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c6, u.d(i++), "g11", c1_1, c4_1, c5_1);
String c1_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c1, u.d(i++), "g11", "g22");
String c5_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c5, u.d(i++), "g22");
String c4_2 = u.runAndPassWithGivenMDUTimestampAndRevisionStrings(c4, u.d(i++), c1_2, c2_1, c3_1);
MaterialRevisions given = u.mrs(u.mr(git1, false, "g11"), u.mr(c1, true, c1_2), u.mr(c4, true, c4_2), u.mr(c5, true, c5_2));
MaterialRevisions expected = u.mrs(u.mr(git1, false, "g11"), u.mr(c1, true, c1_1), u.mr(c4, true, c4_1), u.mr(c5, true, c5_1));
MaterialRevisions actual = getRevisionsBasedOnDependencies(c6, cruiseConfig, given);
assertThat(actual, is(expected));
}
Aggregations