-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-26481] More clearly report problem passing closures to binary methods #15
Changes from 2 commits
efeee2b
6ad4d04
0d2af49
e79482a
ae55312
62a8792
4266f0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,34 @@ public void stop(Throwable cause) throws Exception { | |
}); | ||
} | ||
|
||
@Issue("JENKINS-26481") | ||
@Test public void eachClosureNonCps() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verifies that we are not throwing the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to put the explanation to Javadoc directly |
||
story.addStep(new Statement() { | ||
@Override public void evaluate() throws Throwable { | ||
ScriptApproval.get().approveSignature("staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods plus java.util.Collection java.lang.Object"); | ||
p = jenkins().createProject(WorkflowJob.class, "demo"); | ||
p.setDefinition(new CpsFlowDefinition( | ||
"@NonCPS def fine() {\n" + | ||
" def text = ''\n" + | ||
" ['a', 'b', 'c'].each {it -> text += it}\n" + | ||
" text\n" + | ||
"}\n" + | ||
"def takesMyOwnClosure(body) {\n" + | ||
" node {\n" + | ||
" def list = []\n" + | ||
" list += body\n" + | ||
" echo list[0]()\n" + | ||
" }\n" + | ||
"}\n" + | ||
"takesMyOwnClosure {\n" + | ||
" fine()\n" + | ||
"}\n", true)); | ||
b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); | ||
story.j.assertLogContains("abc", b); | ||
} | ||
}); | ||
} | ||
|
||
@Ignore("TODO JENKINS-31314: calls writeFile just once, echoes null (i.e., return value of writeFile), then succeeds") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still fails with the same behavior. |
||
@Test public void nonCpsContinuable() { | ||
story.addStep(new Statement() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not expect other plugins to have classes in the org.jenkinsci.plugins.workflow.cps package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.