Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6e7526
commit 26735ec
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |