Skip to content
Permalink
Browse files
Merge pull request #195 from svanoort/JENKINS-48644
Test and fix for missing ArgumentsAction string inside a stage
  • Loading branch information
svanoort committed Dec 20, 2017
2 parents 31fec1f + 9a6245c commit b8a9d164cf427cffa12b97635d918aedebd2f2b5
@@ -79,7 +79,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.18</version>
<version>2.24</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -272,6 +272,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<version>2.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
@@ -126,6 +126,7 @@ public static boolean isStringSafe(@CheckForNull String input, @CheckForNull Env
"JOB_URL",
"NODE_LABELS",
"NODE_NAME",
"STAGE_NAME",
"WORKSPACE",

// Normal system variables for posix environments
@@ -14,9 +14,11 @@
import hudson.XmlFile;
import hudson.model.Action;
import hudson.tasks.ArtifactArchiver;
import jenkins.model.Jenkins;
import org.apache.commons.lang.RandomStringUtils;
import org.jenkinsci.plugins.credentialsbinding.impl.BindingStep;
import org.jenkinsci.plugins.workflow.actions.ArgumentsAction;
import org.jenkinsci.plugins.workflow.actions.StageAction;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution;
import org.jenkinsci.plugins.workflow.cps.CpsThread;
@@ -38,13 +40,17 @@
import org.jenkinsci.plugins.workflow.testMetaStep.Oregon;
import org.jenkinsci.plugins.workflow.testMetaStep.StateMetaStep;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import static org.hamcrest.Matchers.*;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -208,6 +214,31 @@ public void testRecursiveSanitizationOfContent() {
Assert.assertEquals(unsanitizedList, impl.sanitizeListAndRecordMutation(unsanitizedList, new EnvVars()));
}

@Test
@Issue("JENKINS-48644")
public void testMissingDescriptionInsideStage() throws Exception {
Assume.assumeTrue(r.jenkins.getComputer("").isUnix()); // No need for windows-specific testing
WorkflowJob j = r.jenkins.createProject(WorkflowJob.class, "HiddenStep");
j.setDefinition(new CpsFlowDefinition("node{\n" +
" stage ('Build') {\n" +
" sh \"echo 'Building'\"\n" +
" }\n" +
" stage ('Test') {\n" +
" sh \"echo 'testing'\"\n" +
" }\n" +
" stage ('Deploy') {\n" +
" sh \"echo 'deploy'\"\n" +
" }\n" +
"}\n", true));
WorkflowRun run = r.buildAndAssertSuccess(j);
List<FlowNode> nodes = new LinearScanner().filteredNodes(run.getExecution(), new NodeStepTypePredicate("sh"));
for (FlowNode f : nodes) {
if (ArgumentsAction.getStepArgumentsAsString(f) == null) {
Assert.fail("No arguments action for node: "+f.toString());
}
}
}

@Test
public void testBasicCreateAndMask() throws Exception {
HashMap<String,String> passwordBinding = new HashMap<String,String>();

0 comments on commit b8a9d16

Please sign in to comment.