Skip to content
Permalink
Browse files

enable test for JENKINS-8342

  • Loading branch information
ndeloof committed Mar 1, 2013
1 parent 2e3cfd3 commit 9625801c185976562467a016e9d6998227c08f41
@@ -104,11 +104,21 @@ protected FreeStyleProject setupProject(String branchString, boolean authorOrCom
String relativeTargetDir, String excludedRegions,
String excludedUsers, String localBranch, boolean fastRemotePoll,
String includedRegions) throws Exception {
return setupProject(Collections.singletonList(new BranchSpec(branchString)),
authorOrCommitter, relativeTargetDir, excludedRegions,
excludedUsers, localBranch, fastRemotePoll,
includedRegions);
}

protected FreeStyleProject setupProject(List<BranchSpec> branches, boolean authorOrCommitter,
String relativeTargetDir, String excludedRegions,
String excludedUsers, String localBranch, boolean fastRemotePoll,
String includedRegions) throws Exception {
FreeStyleProject project = createFreeStyleProject();
project.setScm(new GitSCM(
null,
createRemoteRepositories(),
Collections.singletonList(new BranchSpec(branchString)),
branches,
null,
false, Collections.<SubmoduleConfig>emptyList(), false,
false, new DefaultBuildChooser(), null, null, authorOrCommitter, relativeTargetDir, null,
@@ -200,10 +200,10 @@ public void testBasicExcludedRegion() throws Exception {
}

@Bug(value = 8342)
public void testExcludedRegionMultiCommit() throws Exception {/*
public void testExcludedRegionMultiCommit() throws Exception {
// Got 2 projects, each one should only build if changes in its own file
FreeStyleProject clientProject = setupProject("master", false, null, ".*serverFile", null);
FreeStyleProject serverProject = setupProject("master", false, null, ".*clientFile", null);
FreeStyleProject clientProject = setupProject("master", false, null, ".*serverFile", null, null);
FreeStyleProject serverProject = setupProject("master", false, null, ".*clientFile", null, null);
String initialCommitFile = "initialFile";
commit(initialCommitFile, johnDoe, "initial commit");
build(clientProject, Result.SUCCESS, initialCommitFile);
@@ -224,7 +224,80 @@ public void testExcludedRegionMultiCommit() throws Exception {/*

assertTrue("scm polling did not detect changes in client project", clientProject.poll(listener).hasChanges());
assertTrue("scm polling did not detect changes in server project", serverProject.poll(listener).hasChanges());
*/}
}

/**
* With multiple branches specified in the project and having commits from a user
* excluded should not build the excluded revisions when another branch changes.
*/
@Bug(value = 8342)
public void testMultipleBranchWithExcludedUser() throws Exception { /*
final String branch1 = "Branch1";
final String branch2 = "Branch2";
List<BranchSpec> branches = new ArrayList<BranchSpec>();
branches.add(new BranchSpec("master"));
branches.add(new BranchSpec(branch1));
branches.add(new BranchSpec(branch2));
final FreeStyleProject project = setupProject(branches, false, null, null, janeDoe.getName(), null, false, null);
// create initial commit and then run the build against it:
final String commitFile1 = "commitFile1";
commit(commitFile1, johnDoe, "Commit number 1");
build(project, Result.SUCCESS, commitFile1);
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges());
// create branches here so we can get back to them later...
git.branch(branch1);
git.branch(branch2);
final String commitFile2 = "commitFile2";
commit(commitFile2, johnDoe, "Commit number 2");
final String commitFile3 = "commitFile3";
commit(commitFile3, johnDoe, "Commit number 3");
assertTrue("scm polling should detect changes in 'master' branch", project.poll(listener).hasChanges());
build(project, Result.SUCCESS, commitFile1, commitFile2);
assertFalse("scm polling should not detect any more changes after last build", project.poll(listener).hasChanges());
// Add excluded commit
final String commitFile4 = "commitFile4";
commit(commitFile4, janeDoe, "Commit number 4");
assertFalse("scm polling detected change in 'master', which should have been excluded", project.poll(listener).hasChanges());
// now jump back...
git.checkout(branch1);
final String branch1File1 = "branch1File1";
commit(branch1File1, janeDoe, "Branch1 commit number 1");
assertFalse("scm polling detected change in 'Branch1', which should have been excluded", project.poll(listener).hasChanges());
// and the other branch...
git.checkout(branch2);
final String branch2File1 = "branch2File1";
commit(branch2File1, janeDoe, "Branch2 commit number 1");
assertFalse("scm polling detected change in 'Branch2', which should have been excluded", project.poll(listener).hasChanges());
final String branch2File2 = "branch2File2";
commit(branch2File2, johnDoe, "Branch2 commit number 2");
assertTrue("scm polling should detect changes in 'Branch2' branch", project.poll(listener).hasChanges());
//... and build it...
build(project, Result.SUCCESS, branch2File1, branch2File2);
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges());
// now jump back again...
git.checkout(branch1);
// Commit excluded after non-excluded commit, should trigger build.
final String branch1File2 = "branch1File2";
commit(branch1File2, johnDoe, "Branch1 commit number 2");
final String branch1File3 = "branch1File3";
commit(branch1File3, janeDoe, "Branch1 commit number 3");
assertTrue("scm polling should detect changes in 'Branch1' branch", project.poll(listener).hasChanges());
build(project, Result.SUCCESS, branch1File1, branch1File2, branch1File3);
*/ }

public void testBasicExcludedUser() throws Exception {
FreeStyleProject project = setupProject("master", false, null, null, "Jane Doe", null);

0 comments on commit 9625801

Please sign in to comment.
You can’t perform that action at this time.