Skip to content

Commit 538d2d6

Browse files
add Unit test to ensure ExecutorAction is added to FlowNode
Signed-off-by: Artur Harasimiuk <[email protected]>
1 parent 18eeaa7 commit 538d2d6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java

+29
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
import static org.hamcrest.Matchers.*;
8383
import org.jboss.marshalling.ObjectResolver;
8484
import org.jenkinsci.plugins.durabletask.FileMonitoringTask;
85+
import org.jenkinsci.plugins.workflow.actions.ExecutorAction;
8586
import org.jenkinsci.plugins.workflow.actions.LogAction;
8687
import org.jenkinsci.plugins.workflow.actions.QueueItemAction;
8788
import org.jenkinsci.plugins.workflow.actions.WorkspaceAction;
@@ -916,4 +917,32 @@ private static class FallbackAuthenticator extends QueueItemAuthenticator {
916917
}
917918
}
918919

920+
@Issue("JENKINS-44193")
921+
@Test
922+
public void executionActionIsPresent() throws Exception {
923+
story.addStep(new Statement() {
924+
@Override public void evaluate() throws Throwable {
925+
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "executionActionIsPresent");
926+
p.setDefinition(new CpsFlowDefinition(
927+
"node() {\n" +
928+
" echo \"123\"\n" +
929+
"}", true));
930+
WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
931+
932+
// Wait until the build completes.
933+
story.j.waitForCompletion(b);
934+
935+
FlowGraphWalker walker = new FlowGraphWalker(b.getExecution());
936+
List<ExecutorAction> actions = new ArrayList<ExecutorAction>();
937+
for (FlowNode n : walker) {
938+
ExecutorAction a = n.getAction(ExecutorAction.class);
939+
if (a != null) {
940+
actions.add(a);
941+
}
942+
}
943+
assertEquals(1, actions.size());
944+
}
945+
});
946+
}
947+
919948
}

0 commit comments

Comments
 (0)