Skip to content

Commit

Permalink
[JENKINS-32179] Integration test.
Browse files Browse the repository at this point in the history
Originally-Committed-As: 8739b2321b57cbb638e29ff3941628d11f3057cb
  • Loading branch information
jglick committed Mar 15, 2016
1 parent 9e88a2c commit 596a2cf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion multibranch/pom.xml
Expand Up @@ -58,7 +58,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.2.1</version>
<version>5.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Expand Up @@ -24,7 +24,10 @@

package org.jenkinsci.plugins.workflow.multibranch;

import hudson.ExtensionList;
import hudson.model.DescriptorVisibilityFilter;
import hudson.model.Item;
import hudson.model.listeners.ItemListener;
import hudson.plugins.git.GitSCM;
import hudson.scm.ChangeLogParser;
import hudson.scm.SCM;
Expand Down Expand Up @@ -53,6 +56,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TestExtension;

Expand Down Expand Up @@ -155,4 +159,30 @@ public DescriptorImpl() {
}
}

@Issue("JENKINS-32179")
@Test public void conflictingBranches() throws Exception {
sampleRepo.init();
sampleRepo.write("Jenkinsfile", "");
sampleRepo.git("add", "Jenkinsfile");
sampleRepo.git("commit", "--all", "--message=flow");
WorkflowMultiBranchProject mp = r.jenkins.createProject(WorkflowMultiBranchProject.class, "p");
mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleRepo.toString(), "", "*", "", false), new DefaultBranchPropertyStrategy(new BranchProperty[0])));
mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleRepo.toString(), "", "*", "", false), new DefaultBranchPropertyStrategy(new BranchProperty[0])));
WorkflowJob p = scheduleAndFindBranchProject(mp, "master");
mp.getIndexing().writeWholeLogTo(System.out);
assertEquals(1, mp.getItems().size());
r.waitUntilNoActivity();
WorkflowRun b1 = p.getLastBuild();
assertEquals(1, b1.getNumber());
mp.scheduleBuild2(0).getFuture().get();
mp.getIndexing().writeWholeLogTo(System.out);
assertEquals("[p, p/master]", ExtensionList.lookup(Listener.class).get(0).names.toString());
}
@TestExtension("conflictingBranches") public static class Listener extends ItemListener {
List<String> names = new ArrayList<>();
@Override public void onCreated(Item item) {
names.add(item.getFullName());
}
}

}

0 comments on commit 596a2cf

Please sign in to comment.