提交 b2270887 编写于 作者: J Jesse Glick

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

......@@ -183,6 +183,7 @@ public abstract class LazyBuildMixIn<JobT extends Job<JobT,RunT> & Queue.Task &
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);
......
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();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册