File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
src/test/java/org/jenkinsci/plugins/workflow Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 2424
2525package org .jenkinsci .plugins .workflow .support .storage ;
2626
27+ import hudson .model .Result ;
2728import hudson .util .RobustReflectionConverter ;
2829import java .io .File ;
2930import java .util .ArrayList ;
@@ -84,6 +85,9 @@ public final class BulkFlowNodeStorageTest {
8485 */
8586 var p = r .jenkins .getItemByFullName ("test0" , WorkflowJob .class );
8687 var b = p .getLastBuild ();
88+ // Build is unresumable because the local data was created with PERFORMANCE_OPTIMIZED without a clean shutdown.
89+ r .assertBuildStatus (Result .FAILURE , r .waitForCompletion (b ));
90+ // Existing flow nodes should still be preserved though.
8791 var stageBodyStartNode = (StepStartNode ) b .getExecution ().getNode ("4" );
8892 assertThat (stageBodyStartNode , not (nullValue ()));
8993 var label = stageBodyStartNode .getPersistentAction (LabelAction .class );
Original file line number Diff line number Diff line change 11package org .jenkinsci .plugins .workflow .support .storage ;
22
33
4+ import hudson .model .Result ;
45import hudson .util .RobustReflectionConverter ;
56import java .io .File ;
67import java .util .logging .Level ;
1011import org .jenkinsci .plugins .workflow .cps .nodes .StepStartNode ;
1112import org .jenkinsci .plugins .workflow .graph .AtomNode ;
1213import org .jenkinsci .plugins .workflow .job .WorkflowJob ;
14+ import org .jenkinsci .plugins .workflow .test .steps .SemaphoreStep ;
1315import org .junit .Assert ;
1416import org .junit .Rule ;
1517import org .junit .Test ;
@@ -100,6 +102,8 @@ public void testDeferWriteAndFlush() throws Exception {
100102 */
101103 var p = j .jenkins .getItemByFullName ("test0" , WorkflowJob .class );
102104 var b = p .getLastBuild ();
105+ SemaphoreStep .success ("wait/1" , null );
106+ j .assertBuildStatus (Result .SUCCESS , j .waitForCompletion (b ));
103107 var stageBodyStartNode = (StepStartNode ) b .getExecution ().getNode ("4" );
104108 assertThat (stageBodyStartNode , not (nullValue ()));
105109 var label = stageBodyStartNode .getPersistentAction (LabelAction .class );
Original file line number Diff line number Diff line change @@ -234,6 +234,22 @@ public static class Execution extends AbstractStepExecutionImpl {
234234 }
235235 }
236236
237+ @ Override public void onResume () {
238+ // Only matters for restarts across different JVMs, for example if using @LocalData.
239+ State s = State .get ();
240+ String c = Jenkins .XSTREAM .toXML (getContext ());
241+ synchronized (s ) {
242+ if (s .returnValues .containsKey (k )) {
243+ getContext ().onSuccess (s .returnValues .get (k ));
244+ } else if (s .errors .containsKey (k )) {
245+ getContext ().onFailure (s .errors .get (k ));
246+ } else {
247+ s .contexts .put (k , c );
248+ }
249+ s .notifyAll ();
250+ }
251+ }
252+
237253 private static final long serialVersionUID = 1L ;
238254
239255 }
You can’t perform that action at this time.
0 commit comments