Skip to content
Permalink
Browse files

[JENKINS-43507] Check-pointing work in progress

  • Loading branch information...
stephenc committed Apr 28, 2017
1 parent 8c21a79 commit 077a381528fddfb40620859f1d79ea3b8fb6dc44
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/test/java/integration/EventsTest.java
@@ -76,6 +76,7 @@
import jenkins.scm.impl.mock.MockSCMNavigator;
import jenkins.scm.impl.mock.MockSCMSource;
import jenkins.scm.impl.mock.MockSCMSourceEvent;
import jenkins.scm.impl.trait.WildcardSCMSourceFilterTrait;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.ClassRule;
@@ -1634,6 +1635,35 @@ public void given_orgFolder_when_someReposMatch_then_scanCreatesMatchingProjects
}
}

@Test
public void given_orgFolderWithFilteringTrait_when_someReposMatch_then_scanCreatesMatchingProjects() throws Exception {
try (MockSCMController c = MockSCMController.create()) {
OrganizationFolder prj = r.jenkins.createProject(OrganizationFolder.class, "foo");
prj.getSCMNavigators().add(new MockSCMNavigator(c, new MockSCMDiscoverBranches(),
new WildcardSCMSourceFilterTrait("*", "fu")
));
prj.getProjectFactories().replaceBy(Collections
.singletonList(new BasicMultiBranchProjectFactory(new BasicSCMSourceCriteria("marker.txt"))));
c.createRepository("foo");
c.createRepository("fu");
c.createRepository("bar");
c.createRepository("manchu");
c.addFile("foo", "master", "adding marker", "marker.txt", "A marker".getBytes());
c.addFile("fu", "master", "adding marker", "marker.txt", "A marker".getBytes());
prj.scheduleBuild2(0).getFuture().get();
r.waitUntilNoActivity();
assertThat("A scan picks up a newly qualified repo",
prj.getItems(),
not(is((Collection<MultiBranchProject<?, ?>>) Collections.<MultiBranchProject<?, ?>>emptyList())));
BasicMultiBranchProject foo = (BasicMultiBranchProject) prj.getItem("foo");
assertThat("We now have the one project matching", foo, notNullValue());
assertThat("We now have only the one project matching",
prj.getItems(),
Matchers.<MultiBranchProject<?, ?>>containsInAnyOrder(foo));
assertThat("The matching branch exists", foo.getItem("master"), notNullValue());
}
}

@Test
@Issue("JENKINS-42000")
public void given_orgFolder_when_navigatorIoErrorScanning_then_scanRecordedAsFailure() throws Exception {

0 comments on commit 077a381

Please sign in to comment.
You can’t perform that action at this time.