@@ -26,23 +26,39 @@ public class TestUtils {
26
26
27
27
public static WorkflowRun createAndRunJob (
28
28
JenkinsRule jenkins , String jobName , String jenkinsFileName , Result expectedResult ) throws Exception {
29
- WorkflowJob job = TestUtils .createJob (jenkins , jobName , jenkinsFileName );
29
+ return createAndRunJob (jenkins , jobName , jenkinsFileName , expectedResult , true );
30
+ }
31
+
32
+ public static WorkflowRun createAndRunJob (
33
+ JenkinsRule jenkins , String jobName , String jenkinsFileName , Result expectedResult , boolean sandbox )
34
+ throws Exception {
35
+ WorkflowJob job = TestUtils .createJob (jenkins , jobName , jenkinsFileName , sandbox );
30
36
jenkins .assertBuildStatus (expectedResult , job .scheduleBuild2 (0 ));
31
37
return job .getLastBuild ();
32
38
}
33
39
34
40
public static QueueTaskFuture <WorkflowRun > createAndRunJobNoWait (
35
41
JenkinsRule jenkins , String jobName , String jenkinsFileName ) throws Exception {
36
- WorkflowJob job = TestUtils .createJob (jenkins , jobName , jenkinsFileName );
42
+ return createAndRunJobNoWait (jenkins , jobName , jenkinsFileName , true );
43
+ }
44
+
45
+ public static QueueTaskFuture <WorkflowRun > createAndRunJobNoWait (
46
+ JenkinsRule jenkins , String jobName , String jenkinsFileName , boolean sandbox ) throws Exception {
47
+ WorkflowJob job = TestUtils .createJob (jenkins , jobName , jenkinsFileName , sandbox );
37
48
return job .scheduleBuild2 (0 );
38
49
}
39
50
40
51
public static WorkflowJob createJob (JenkinsRule jenkins , String jobName , String jenkinsFileName ) throws Exception {
52
+ return createJob (jenkins , jobName , jenkinsFileName , true );
53
+ }
54
+
55
+ public static WorkflowJob createJob (JenkinsRule jenkins , String jobName , String jenkinsFileName , boolean sandbox )
56
+ throws Exception {
41
57
WorkflowJob job = jenkins .createProject (WorkflowJob .class , jobName );
42
58
43
59
URL resource = Resources .getResource (TestUtils .class , jenkinsFileName );
44
60
String jenkinsFile = Resources .toString (resource , Charsets .UTF_8 );
45
- job .setDefinition (new CpsFlowDefinition (jenkinsFile , true ));
61
+ job .setDefinition (new CpsFlowDefinition (jenkinsFile , sandbox ));
46
62
return job ;
47
63
}
48
64
0 commit comments