|
15 | 15 | import hudson.plugins.git.opt.PreBuildMergeOptions; |
16 | 16 | import hudson.plugins.git.util.DefaultBuildChooser; |
17 | 17 | import hudson.util.StreamTaskListener; |
| 18 | + |
| 19 | +import org.jvnet.hudson.test.Bug; |
18 | 20 | import org.jvnet.hudson.test.CaptureEnvironmentBuilder; |
19 | 21 | import org.jvnet.hudson.test.HudsonTestCase; |
20 | 22 |
|
@@ -88,6 +90,33 @@ public void testBasicExcludedRegion() throws Exception { |
88 | 90 | assertFalse("scm polling should not detect any more changes after build", project.pollSCMChanges(listener)); |
89 | 91 | } |
90 | 92 |
|
| 93 | + @Bug(value = 8342) |
| 94 | + public void testExcludedRegionMultiCommit() throws Exception { |
| 95 | + // Got 2 projects, each one should only build if changes in its own file |
| 96 | + FreeStyleProject clientProject = setupProject("master", false, null, ".*serverFile", null); |
| 97 | + FreeStyleProject serverProject = setupProject("master", false, null, ".*clientFile", null); |
| 98 | + String initialCommitFile = "initialFile"; |
| 99 | + commit(initialCommitFile, johnDoe, "initial commit"); |
| 100 | + build(clientProject, Result.SUCCESS, initialCommitFile); |
| 101 | + build(serverProject, Result.SUCCESS, initialCommitFile); |
| 102 | + |
| 103 | + assertFalse("scm polling should not detect any more changes after initial build", clientProject.poll(listener).hasChanges()); |
| 104 | + assertFalse("scm polling should not detect any more changes after initial build", serverProject.poll(listener).hasChanges()); |
| 105 | + |
| 106 | + // Got commits on serverFile, so only server project should build. |
| 107 | + commit("myserverFile", johnDoe, "commit first server file"); |
| 108 | + |
| 109 | + assertFalse("scm polling should not detect any changes in client project", clientProject.poll(listener).hasChanges()); |
| 110 | + assertTrue("scm polling did not detect changes in server project", serverProject.poll(listener).hasChanges()); |
| 111 | + |
| 112 | + // Got commits on both client and serverFile, so both projects should build. |
| 113 | + commit("myNewserverFile", johnDoe, "commit new server file"); |
| 114 | + commit("myclientFile", johnDoe, "commit first clientfile"); |
| 115 | + |
| 116 | + assertTrue("scm polling did not detect changes in client project", clientProject.poll(listener).hasChanges()); |
| 117 | + assertTrue("scm polling did not detect changes in server project", serverProject.poll(listener).hasChanges()); |
| 118 | + } |
| 119 | + |
91 | 120 | public void testBasicExcludedUser() throws Exception { |
92 | 121 | FreeStyleProject project = setupProject("master", false, null, null, "Jane Doe"); |
93 | 122 |
|
|
0 commit comments