Skip to content

Commit

Permalink
[JENKINS-20662] Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-beck committed Apr 18, 2014
1 parent e6e7526 commit 26735ec
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
@@ -0,0 +1,33 @@
package jenkins.model.lazy

import hudson.model.Run
import hudson.model.TaskListener
import hudson.model.listeners.RunListener
import org.junit.Rule
import org.junit.Test
import org.jvnet.hudson.test.Bug
import org.jvnet.hudson.test.JenkinsRule

class LazyBuildMixIn_Test {
@Rule
public JenkinsRule r = new JenkinsRule();

@Test
@Bug(20662)
public void testNewRunningBuildRelationFromPrevious() {
RunListener<Run> listener = new RunListener<Run>() {
@Override public void onCompleted(Run r, TaskListener listener) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
};
RunListener.all().add(listener);
def p = r.createFreeStyleProject();
def b1 = p.scheduleBuild2(0).get();
assert null == b1.getNextBuild();
def b2 = p.scheduleBuild2(0).waitForStart();
assert b2 == b1.getNextBuild();
}
}

0 comments on commit 26735ec

Please sign in to comment.