Skip to content

Commit

Permalink
Test polling of parent of HEAD commit with and without workspace
Browse files Browse the repository at this point in the history
More testing of JENKINS-29066
  • Loading branch information
MarkEWaite authored and ndeloof committed Jun 29, 2015
1 parent e5c75f1 commit 06dc97f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/test/java/hudson/plugins/git/GitSCMTest.java
Expand Up @@ -1429,28 +1429,45 @@ public void testPolling_environmentValueInBranchSpec() throws Exception {
}

@Issue("JENKINS-29066")
public void testPolling_parentHead() throws Exception {
public void baseTestPolling_parentHead(List<GitSCMExtension> extensions) throws Exception {
// create parameterized project with environment value in branch specification
FreeStyleProject project = createFreeStyleProject();
GitSCM scm = new GitSCM(
createRemoteRepositories(),
Collections.singletonList(new BranchSpec("**")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null,
Collections.<GitSCMExtension>emptyList());
extensions);
project.setScm(scm);

// commit something in order to create an initial base version in git
commit("toto/commitFile1", johnDoe, "Commit number 1");
git.branch("someBranch");
commit("toto/commitFile2", johnDoe, "Commit number 2");

assertTrue("polling should detect changes",project.poll(listener).hasChanges());

// build the project
build(project, Result.SUCCESS);

/* Expects 1 build because the build of someBranch incorporates all
* the changes from the master branch as well as the changes from someBranch.
*/
assertEquals("Wrong number of builds", 1, project.getBuilds().size());

assertFalse("polling should not detect changes",project.poll(listener).hasChanges());
}

@Issue("JENKINS-29066")
public void testPolling_parentHead() throws Exception {
baseTestPolling_parentHead(Collections.<GitSCMExtension>emptyList());
}

@Issue("JENKINS-29066")
public void testPolling_parentHead_DisableRemotePoll() throws Exception {
baseTestPolling_parentHead(Collections.<GitSCMExtension>singletonList(new DisableRemotePoll()));
}

public void testPollingAfterManualBuildWithParametrizedBranchSpec() throws Exception {
// create parameterized project with environment value in branch specification
FreeStyleProject project = createFreeStyleProject();
Expand Down

0 comments on commit 06dc97f

Please sign in to comment.