Skip to content
Permalink
Browse files

Merge branch 'JENKINS-20662' of github.com:daniel-beck/jenkins

  • Loading branch information
jglick committed Apr 23, 2014
2 parents 54c5df2 + b59c490 commit b227088704070acf5a50486be0ff6a315e36a9c5
@@ -183,6 +183,7 @@ public final synchronized RunT newBuild() throws IOException {
try {
RunT lastBuild = getBuildClass().getConstructor(asJob().getClass()).newInstance(asJob());
builds.put(lastBuild);
lastBuild.getPreviousBuild(); // JENKINS-20662: create connection to previous build
return lastBuild;
} catch (InstantiationException e) {
throw new Error(e);
@@ -0,0 +1,26 @@
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.SleepBuilder
import org.jvnet.hudson.test.JenkinsRule

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

@Test
@Bug(20662)
public void testNewRunningBuildRelationFromPrevious() {
def p = r.createFreeStyleProject();
p.buildersList.replaceBy([new SleepBuilder(1000)])
def b1 = p.scheduleBuild2(0).get();
assert null == b1.getNextBuild();
def b2 = p.scheduleBuild2(0).waitForStart();
assert b2 == b1.getNextBuild();
}
}

0 comments on commit b227088

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