File tree Expand file tree Collapse file tree 3 files changed +47
-94
lines changed
groovy/org/jenkinsci/plugins/workflow/cps
java/org/jenkinsci/plugins/workflow/cps Expand file tree Collapse file tree 3 files changed +47
-94
lines changed Original file line number Diff line number Diff line change 289289 </resource >
290290 </resources >
291291 <plugins >
292- <plugin >
293- <!-- why is this necessary!? otherwise compiling src/test/groovy/ fails -->
294- <!-- fix attempted at https://github.com/jenkinsci/jenkins/commit/101507f49873de0239ccb7839649ea71187712b2 but apparently failed. -->
295- <groupId >org.codehaus.gmaven</groupId >
296- <artifactId >gmaven-plugin</artifactId >
297- <configuration >
298- <providerSelection >1.8</providerSelection >
299- </configuration >
300- </plugin >
301292 <plugin >
302293 <groupId >org.jenkins-ci.tools</groupId >
303294 <artifactId >maven-hpi-plugin</artifactId >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package org .jenkinsci .plugins .workflow .cps ;
2+
3+ import org .junit .Test ;
4+
5+ import static org .junit .Assert .assertTrue ;
6+ import static org .junit .Assert .assertEquals ;
7+
8+ /**
9+ * @author Kohsuke Kawaguchi
10+ */
11+ public class CpsFlowDefinitionTest extends AbstractCpsFlowTest {
12+ /**
13+ * CpsFlowDefinition's simplest possible test.
14+ */
15+ @ Test
16+ public void simplestPossibleTest () throws Exception {
17+ CpsFlowDefinition flow = new CpsFlowDefinition (
18+ "def sqrt(int x) { return Math.sqrt(x); }\n " +
19+ "for (int i=0; i<10; i++) { sqrt(i); }" ,
20+ false );
21+
22+ createExecution (flow );
23+ exec .start ();
24+ exec .waitForSuspension ();
25+
26+ assertTrue (exec .isComplete ());
27+ }
28+
29+ @ Test
30+ public void exceptionInWorkflowShouldBreakFlowExecution () throws Exception {
31+ CpsFlowDefinition flow = new CpsFlowDefinition (
32+ "throw new Throwable('This is a fire drill, not a real fire');" ,
33+ false );
34+
35+ // get this going...
36+ createExecution (flow );
37+ exec .start ();
38+
39+ // it should stop at watch and suspend.
40+ exec .waitForSuspension ();
41+ assertTrue (exec .isComplete ());
42+ Throwable t = exec .getCauseOfFailure ();
43+ assertEquals (Throwable .class , t .getClass ());
44+ assertEquals ("This is a fire drill, not a real fire" , t .getMessage ());
45+ }
46+
47+ }
You can’t perform that action at this time.
0 commit comments