Skip to content

Commit

Permalink
[FIXED JENKINS-8342] Pulled from hajoeichler and added testcase to ve…
Browse files Browse the repository at this point in the history
…rify the issue
  • Loading branch information
pnyheim committed Jul 6, 2011
1 parent ae3f386 commit 462a65c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/java/hudson/plugins/git/GitSCMTest.java
Expand Up @@ -15,6 +15,8 @@
import hudson.plugins.git.opt.PreBuildMergeOptions;
import hudson.plugins.git.util.DefaultBuildChooser;
import hudson.util.StreamTaskListener;

import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.CaptureEnvironmentBuilder;
import org.jvnet.hudson.test.HudsonTestCase;

Expand Down Expand Up @@ -88,6 +90,33 @@ public void testBasicExcludedRegion() throws Exception {
assertFalse("scm polling should not detect any more changes after build", project.pollSCMChanges(listener));
}

@Bug(value = 8342)
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);
String initialCommitFile = "initialFile";
commit(initialCommitFile, johnDoe, "initial commit");
build(clientProject, Result.SUCCESS, initialCommitFile);
build(serverProject, Result.SUCCESS, initialCommitFile);

assertFalse("scm polling should not detect any more changes after initial build", clientProject.poll(listener).hasChanges());
assertFalse("scm polling should not detect any more changes after initial build", serverProject.poll(listener).hasChanges());

// Got commits on serverFile, so only server project should build.
commit("myserverFile", johnDoe, "commit first server file");

assertFalse("scm polling should not detect any changes in client project", clientProject.poll(listener).hasChanges());
assertTrue("scm polling did not detect changes in server project", serverProject.poll(listener).hasChanges());

// Got commits on both client and serverFile, so both projects should build.
commit("myNewserverFile", johnDoe, "commit new server file");
commit("myclientFile", johnDoe, "commit first clientfile");

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());
}

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

Expand Down

0 comments on commit 462a65c

Please sign in to comment.