Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-26481] Creating integration test.
Originally-Committed-As: 07f36024c20fb900c99de6d02d7d0acef6f62b5a
  • Loading branch information
jglick committed Mar 31, 2016
1 parent c74b113 commit f912219
Showing 1 changed file with 31 additions and 1 deletion.
Expand Up @@ -203,11 +203,41 @@ public void stop(Throwable cause) throws Exception {
});
}

@Ignore("TODO fails even with https://github.com/cloudbees/groovy-cps/pull/23")
@Issue("JENKINS-26481")
@Test public void eachClosure() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition(
"node {\n" +
" ['a', 'b', 'c'].each {f -> writeFile file: f, text: f}\n" +
" def text = ''\n" +
" ['a', 'b', 'c'].each {f -> semaphore f; text += readFile f}\n" +
" echo text\n" +
"}\n", true));
b = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("a/1", b);
SemaphoreStep.success("a/1", null);
SemaphoreStep.waitForStart("b/1", b);
}
});
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
rebuildContext(story.j);
SemaphoreStep.success("b/1", null);
SemaphoreStep.waitForStart("c/1", b);
SemaphoreStep.success("c/1", null);
story.j.assertBuildStatusSuccess(b);
story.j.assertLogContains("abc", b);
}
});
}

@Ignore("TODO JENKINS-31314: calls writeFile just once, echoes null (i.e., return value of writeFile), then succeeds")
@Test public void nonCpsContinuable() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
ScriptApproval.get().approveSignature("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods each java.lang.Object groovy.lang.Closure"); // TODO whitelist; should work inside @NonCPS but pending JENKINS-26481 not outside
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition(
"@NonCPS def shouldBomb() {\n" +
Expand Down

0 comments on commit f912219

Please sign in to comment.