Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check null values
  • Loading branch information
jetersen committed Feb 19, 2020
commit 20d8cf70d5bcff02244d21574010d1a11652bf1e
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ public class EnvStepTest {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"node {\n" +
" withEnv(a: 1, b: 2, c: 'hello world', d: true) {\n" +
" echo \"a=$a b=$b c=$c d=$d\"" +
" withEnv(a: 1, b: 2, c: 'hello world', d: true, e: null) {\n" +
" echo(/a=$a b=$b c=$c d=$d, e=${env.e}/)" +
" }\n" +
"}", true));
WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
story.j.assertLogContains("a=1 b=2 c=hello world d=true", b);
story.j.assertLogContains("a=1 b=2 c=hello world d=true e=null", b);
List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(
b.getExecution(),
Predicates.and(
new NodeStepTypePredicate("withEnv"),
n -> n instanceof StepStartNode && !((StepStartNode) n).isBody()));
assertThat(coreStepNodes, Matchers.hasSize(1));
assertEquals("a, b, c, d", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
assertEquals("a, b, c, d, e", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
});
}
Expand All @@ -187,19 +187,19 @@ public class EnvStepTest {
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"node {\n" +
" withEnv([A: 1, B: 2, C: 'hello world', D: true]) {\n" +
" echo \"A=$A B=$B C=$C D=$D\"\n" +
" withEnv([A: 1, B: 2, C: 'hello world', D: true, E: null]) {\n" +
" echo(/A=$A B=$B C=$C D=$D E=${env.E}/)\n" +
" }\n" +
"}", true));
WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
story.j.assertLogContains("A=1 B=2 C=hello world D=true", b);
story.j.assertLogContains("A=1 B=2 C=hello world D=true E=null", b);
List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(
b.getExecution(),
Predicates.and(
new NodeStepTypePredicate("withEnv"),
n -> n instanceof StepStartNode && !((StepStartNode) n).isBody()));
assertThat(coreStepNodes, Matchers.hasSize(1));
assertEquals("A, B, C, D", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
assertEquals("A, B, C, D, E", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
});
}
Expand Down