Skip to content

Commit 039801b

Browse files
authored
Merge pull request #812 from jglick/evaluateAfterRestart
Test coverage for `evaluate`ing classes across restarts
2 parents a3a6988 + 0b62ffe commit 039801b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plugin/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecutionTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,26 @@ public boolean isAllowed(String groovyResourceUrl) {
703703
}
704704
}
705705

706+
@Test public void evaluateAfterRestart() throws Throwable {
707+
sessions.then(r -> {
708+
WorkflowJob p = r.createProject(WorkflowJob.class, "p");
709+
p.setDefinition(new CpsFlowDefinition(
710+
"def x = evaluate('class X {X() {}; def m1() {/OK/}}; new X()')\n" +
711+
"def y = evaluate('class Y {X x; def m2() {/really ${x.m1()}/}}; new Y()')\n" +
712+
"semaphore('wait')\n" +
713+
"y.x = x\n" +
714+
"echo(/received ${y.m2()}/)\n", true));
715+
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
716+
SemaphoreStep.waitForStart("wait/1", b);
717+
});
718+
sessions.then(r -> {
719+
WorkflowJob p = r.jenkins.getItemByFullName("p", WorkflowJob.class);
720+
WorkflowRun b = p.getLastBuild();
721+
SemaphoreStep.success("wait/1", null);
722+
r.assertLogContains("received really OK", r.assertBuildStatus(Result.SUCCESS, r.waitForCompletion(b)));
723+
});
724+
}
725+
706726
@Issue({ "JENKINS-45327", "JENKINS-68849" })
707727
@Test public void envActionImplPickle() throws Throwable {
708728
sessions.then(r -> {

0 commit comments

Comments
 (0)