Skip to content
Browse files
[JENKINS-20392] Add test for Recent-History-Bug in merge-jobs.
  • Loading branch information
mlex committed Aug 1, 2014
1 parent b280169 commit beab37d9c891bf88680e5ebdff56411d507e9797
Showing 1 changed file with 35 additions and 0 deletions.
@@ -22,6 +22,7 @@
import hudson.remoting.Callable;
import hudson.remoting.Channel;
import hudson.remoting.VirtualChannel;
import hudson.scm.ChangeLogSet;
import hudson.scm.PollingResult;
import hudson.slaves.DumbSlave;
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry;
@@ -873,6 +874,40 @@ public void testMerge() throws Exception {
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges());

public void testMergeChangelog() throws Exception {
FreeStyleProject project = setupSimpleProject("master");

GitSCM scm = new GitSCM(
Collections.singletonList(new BranchSpec("*")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null,
scm.getExtensions().add(new PreBuildMerge(new UserMergeOptions("origin", "integration", "default")));

// create initial commit and then run the build against it:
// Here the changelog is by default empty (because changelog for first commit is always empty
commit("commitFileBase", johnDoe, "Initial Commit");
build(project, Result.SUCCESS, "commitFileBase");

// Create second commit and run build
// Here the changelog should contain exactly this one new commit
testRepo.git.checkout("master", "topic2");
final String commitFile2 = "commitFile2";
String commitMessage = "Commit number 2";
commit(commitFile2, johnDoe, commitMessage);
final FreeStyleBuild build2 = build(project, Result.SUCCESS, commitFile2);

ChangeLogSet<? extends ChangeLogSet.Entry> changeLog = build2.getChangeSet();
assertEquals("Changelog should contain one item", 1, changeLog.getItems().length);

GitChangeSet singleChange = (GitChangeSet) changeLog.getItems()[0];
assertEquals("Changelog should contain commit number 2", commitMessage, singleChange.getComment().trim());

public void testMergeWithSlave() throws Exception {
FreeStyleProject project = setupSimpleProject("master");

0 comments on commit beab37d

Please sign in to comment.