Skip to content

Commit

Permalink
Consistently use sandbox for CpsFlowDefinitions
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jul 21, 2019
1 parent 4751bb5 commit b0fb658
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public class CleaupJobsTest {
@Test
public void cleaupTrackedJobsOnDeleted() throws Exception {
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("milestone 1;milestone 2"));
p.setDefinition(new CpsFlowDefinition("milestone 1;milestone 2", true));
j.assertBuildStatusSuccess(p.scheduleBuild2(0));
j.assertBuildStatusSuccess(p.scheduleBuild2(0));

p.delete();

p = j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("milestone 1;milestone 2"));
p.setDefinition(new CpsFlowDefinition("milestone 1;milestone 2", true));
j.assertBuildStatusSuccess(p.scheduleBuild2(0)); // build #1 is not cancelled

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void buildsMustPassThroughInOrder() {
"milestone()\n" +
"echo 'Passed second milestone'\n" +
"milestone()\n" +
"echo 'Passed third milestone'\n"));
"echo 'Passed third milestone'\n", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("inorder/1", b1);
WorkflowRun b2 = p.scheduleBuild2(0).waitForStart();
Expand Down Expand Up @@ -97,7 +97,7 @@ public void olderBuildsMustBeCancelledOnMilestoneExit() {
"echo 'First milestone'\n" +
"semaphore 'wait'\n" +
"milestone()\n" +
"echo 'Second milestone'\n"));
"echo 'Second milestone'\n", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
WorkflowRun b2 = p.scheduleBuild2(0).waitForStart();
Expand All @@ -124,7 +124,7 @@ public void olderBuildsMustBeCancelledOnBuildFinish() {
"node {\n" +
" echo 'First milestone'\n" +
" semaphore 'wait'\n" +
"}"));
"}", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
WorkflowRun b2 = p.scheduleBuild2(0).waitForStart();
Expand All @@ -151,7 +151,7 @@ public void olderBuildsMustBeCancelledOnBuildAborted() {
"node {\n" +
" echo 'First milestone'\n" +
" semaphore 'wait'\n" +
"}"));
"}", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b1);
WorkflowRun b2 = p.scheduleBuild2(0).waitForStart();
Expand Down Expand Up @@ -180,7 +180,7 @@ public void milestoneNotAllowedInsideParallel() {
" }\n" +
" milestone()\n" +
"}\n" +
"milestone()\n"));
"milestone()\n", true));
WorkflowRun b1 = story.j.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
story.j.assertLogContains("Using a milestone step inside parallel is not allowed", b1);

Expand All @@ -192,7 +192,7 @@ public void milestoneNotAllowedInsideParallel() {
" milestone()\n" +
" }\n" +
"}\n" +
"milestone()\n"));
"milestone()\n", true));
WorkflowRun b2 = story.j.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
story.j.assertLogContains("Using a milestone step inside parallel is not allowed", b2);

Expand All @@ -204,7 +204,7 @@ public void milestoneNotAllowedInsideParallel() {
" echo 'Inside node'\n" +
" }\n" +
"}\n" +
"milestone()\n"));
"milestone()\n", true));
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
}
});
Expand All @@ -222,7 +222,7 @@ public void milestoneAllowedOutsideParallel() {
" echo 'In-node'\n" +
" }\n" +
" milestone 1\n" +
"}"));
"}", true));
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
}
});
Expand All @@ -240,7 +240,7 @@ public void ordinals() {
"}\n" +
"milestone()\n" +
"milestone 5\n" +
"milestone()"));
"milestone()", true));
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));

p.setDefinition(new CpsFlowDefinition(
Expand All @@ -249,7 +249,7 @@ public void ordinals() {
" milestone()\n" +
"}\n" +
"milestone()\n" +
"milestone ordinal: 2")); // Invalid ordinal
"milestone ordinal: 2", true)); // Invalid ordinal
story.j.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
}
});
Expand Down

0 comments on commit b0fb658

Please sign in to comment.