Skip to content

Commit

Permalink
[JENKINS-27421] Reproduced in test.
Browse files Browse the repository at this point in the history
Originally-Committed-As: e916b5e9f35b00db679360dc29e42658d566efb7
  • Loading branch information
jglick committed Sep 10, 2015
1 parent cb5463a commit 0ceee9b
Showing 1 changed file with 42 additions and 0 deletions.
Expand Up @@ -2,6 +2,7 @@

import hudson.model.Result;
import hudson.slaves.DumbSlave;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.steps.AbstractStepDescriptorImpl;
Expand All @@ -15,6 +16,8 @@
import org.jvnet.hudson.test.TestExtension;
import org.kohsuke.stapler.DataBoundConstructor;
import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
import org.jvnet.hudson.test.Issue;

/**
* Tests related to serialization of program state.
Expand Down Expand Up @@ -143,4 +146,43 @@ public void stop(Throwable cause) throws Exception {
});
}

@Ignore("TODO java.io.NotSerializableException: java.util.ArrayList$Itr")
@Issue("JENKINS-27421")
@Test public void listIterator() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition(
"def arr = []; arr += 'one'; arr += 'two'\n" +
"for (int i = 0; i < arr.size(); i++) {def elt = arr[i]; echo \"running C-style loop on ${elt}\"; semaphore \"C-${elt}\"}\n" +
"for (def elt : arr) {echo \"running new-style loop on ${elt}\"; semaphore \"new-${elt}\"}"
, true));
ScriptApproval.get().approveSignature("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods plus java.util.Collection java.lang.Object"); // TODO ought to be in generic-whitelist
startBuilding();
SemaphoreStep.waitForStart("C-one/1", b);
story.j.waitForMessage("running C-style loop on one", b);
}
});
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
rebuildContext(story.j);
SemaphoreStep.success("C-one/1", null);
SemaphoreStep.success("C-two/1", null);
story.j.waitForMessage("running C-style loop on two", b);
SemaphoreStep.waitForStart("new-one/1", b);
story.j.waitForMessage("running new-style loop on one", b);
}
});
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
rebuildContext(story.j);
SemaphoreStep.success("new-one/1", null);
SemaphoreStep.success("new-two/1", null);
story.j.waitForCompletion(b);
story.j.assertBuildStatusSuccess(b);
story.j.assertLogContains("running new-style loop on two", b);
}
});
}

}

0 comments on commit 0ceee9b

Please sign in to comment.