Skip to content

Commit

Permalink
Merge pull request jenkinsci#84 from basil/sandbox
Browse files Browse the repository at this point in the history
Consistently use sandbox for CpsFlowDefinitions
  • Loading branch information
dwnusbaum authored Dec 16, 2019
2 parents dc12464 + 010cd0c commit 488f87f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void trackerPropertyUpgrade() throws Exception {
@Test public void concurrentBuildProperty() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
// Verify the base case behavior.
p.setDefinition(new CpsFlowDefinition("semaphore 'hang'"));
p.setDefinition(new CpsFlowDefinition("semaphore 'hang'", true));

assertTrue(p.isConcurrentBuild());

Expand All @@ -346,7 +346,7 @@ public void trackerPropertyUpgrade() throws Exception {

// Verify that the property successfully disables concurrent builds.
p.setDefinition(new CpsFlowDefinition("properties([disableConcurrentBuilds()])\n"
+ "semaphore 'hang'"));
+ "semaphore 'hang'", true));

assertTrue(p.isConcurrentBuild());

Expand All @@ -372,7 +372,7 @@ public void trackerPropertyUpgrade() throws Exception {
@Test public void triggersProperty() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
// Verify the base case behavior.
p.setDefinition(new CpsFlowDefinition("echo 'foo'"));
p.setDefinition(new CpsFlowDefinition("echo 'foo'", true));

assertTrue(p.getTriggers().isEmpty());

Expand All @@ -384,7 +384,8 @@ public void trackerPropertyUpgrade() throws Exception {
// Now add a trigger.
p.setDefinition(new CpsFlowDefinition(
"properties([pipelineTriggers([\n"
+ " cron('@daily'), [$class: 'MockTrigger']])])\n" + "echo 'foo'"));
+ " cron('@daily'), [$class: 'MockTrigger']])])\n" + "echo 'foo'",
true));

WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));

Expand All @@ -409,7 +410,7 @@ public void trackerPropertyUpgrade() throws Exception {
// Now run a properties step with a different property and verify that we still have a
// PipelineTriggersJobProperty, but with no triggers in it.
p.setDefinition(new CpsFlowDefinition("properties([disableConcurrentBuilds()])\n"
+ "echo 'foo'"));
+ "echo 'foo'", true));

WorkflowRun b2 = r.assertBuildStatusSuccess(p.scheduleBuild2(0));

Expand All @@ -424,7 +425,7 @@ public void trackerPropertyUpgrade() throws Exception {
@Test public void scmTriggerProperty() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
// Verify the base case behavior.
p.setDefinition(new CpsFlowDefinition("echo 'foo'"));
p.setDefinition(new CpsFlowDefinition("echo 'foo'", true));

assertTrue(p.getTriggers().isEmpty());

Expand Down Expand Up @@ -471,7 +472,7 @@ public void trackerPropertyUpgrade() throws Exception {
// Now run a properties step with a different property and verify that we still have a
// PipelineTriggersJobProperty, but with no triggers in it.
p.setDefinition(new CpsFlowDefinition("properties([disableConcurrentBuilds()])\n"
+ "echo 'foo'"));
+ "echo 'foo'", true));

WorkflowRun b2 = r.assertBuildStatusSuccess(p.scheduleBuild2(0));

Expand All @@ -485,7 +486,7 @@ public void trackerPropertyUpgrade() throws Exception {
@Test public void scmAndEmptyTriggersProperty() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
// Verify the base case behavior.
p.setDefinition(new CpsFlowDefinition("echo 'foo'"));
p.setDefinition(new CpsFlowDefinition("echo 'foo'", true));

assertTrue(p.getTriggers().isEmpty());

Expand Down Expand Up @@ -514,7 +515,7 @@ public void trackerPropertyUpgrade() throws Exception {
// Now run a properties step with an empty triggers property and verify that we still have a
// PipelineTriggersJobProperty, but with no triggers in it.
p.setDefinition(new CpsFlowDefinition("properties([pipelineTriggers()])\n"
+ "echo 'foo'"));
+ "echo 'foo'", true));

WorkflowRun b2 = r.assertBuildStatusSuccess(p.scheduleBuild2(0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void given_existingHeadName_when_invoked_then_existingHeadNameReturned()
+ "targets:['foo']\n"
+ " checkout tests\n"
+ " if (!fileExists('new-file.txt')) { error 'wrong branch checked out' }\n"
+ "}"));
+ "}", true));
j.buildAndAssertSuccess(job);
} finally {
c.close();
Expand All @@ -81,7 +81,7 @@ public void given_nonExistingHeadName_when_invokedIgnoringErrors_then_nullReturn
+ "', repository:'repo', traits: [discoverBranches()]), "
+ "targets:['bar'], ignoreErrors: true\n"
+ " if (tests != null) { error \"resolved as ${tests}\"}\n"
+ "}"));
+ "}", true));
j.buildAndAssertSuccess(job);
} finally {
c.close();
Expand All @@ -105,7 +105,7 @@ public void given_nonExistingHeadName_when_invoked_then_abortThrown() throws Exc
+ " ok = false\n"
+ " } catch (e) {}\n"
+ " if (!ok) { error 'abort not thrown' }\n"
+ "}"));
+ "}", true));
j.buildAndAssertSuccess(job);
} finally {
c.close();
Expand All @@ -127,7 +127,7 @@ public void given_nonExistingHeadName_when_invokedWithDefault_then_defaultReturn
+ "targets:['bar', 'manchu']\n"
+ " checkout tests\n"
+ " if (!fileExists('new-file.txt')) { error 'wrong branch checked out' }\n"
+ "}"));
+ "}", true));
j.buildAndAssertSuccess(job);
} finally {
c.close();
Expand Down

0 comments on commit 488f87f

Please sign in to comment.