Skip to content

Commit

Permalink
Merge pull request #85 from varyvol/JENKINS-41842
Browse files Browse the repository at this point in the history
[JENKINS-41842] Increase test coverage for computed folder
  • Loading branch information
jglick committed Feb 10, 2017
2 parents 304c051 + f8eb6a3 commit 62d6b18
Showing 1 changed file with 27 additions and 1 deletion.
Expand Up @@ -62,7 +62,6 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.jvnet.hudson.test.Issue;
Expand Down Expand Up @@ -155,6 +154,33 @@ public void runningBuild() throws Exception {
d.assertItemNames(5);
}

@Test
public void notAddChildren() throws Exception {
JenkinsRule.WebClient client = r.createWebClient();
SampleComputedFolder s = r.jenkins.createProject(SampleComputedFolder.class, "s");

assertEquals(client.getPage(s).getByXPath("//a[contains(text(), \"New Item\")]").size(), 0);

s.kids.add("A");
s.recompute(Result.SUCCESS);

assertEquals(client.getPage(s).getByXPath("//a[contains(text(), \"New Item\")]").size(), 0);
}

@Test
public void runByTrigger() throws Exception {
SampleComputedFolder s = r.jenkins.createProject(SampleComputedFolder.class, "s");
s.assertItemNames(0);

PeriodicFolderTrigger t = new PeriodicFolderTrigger("1m");
s.addTrigger(t);
t.run();

r.waitUntilNoActivity();

s.assertItemNames(1);
}

/** Verify that running branch projects are not deleted even after an organization folder reindex. */
@Issue("JENKINS-25240")
@Test
Expand Down

0 comments on commit 62d6b18

Please sign in to comment.