Skip to content

Commit

Permalink
Test case for JENKINS-57253
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 10, 2021
1 parent 89921be commit 926721c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
import org.jenkinsci.plugins.workflow.steps.StepDescriptor;
import org.jenkinsci.plugins.workflow.steps.StepExecution;
import org.jenkinsci.plugins.workflow.steps.StepExecutions;
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;

import static org.junit.Assert.*;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
Expand Down Expand Up @@ -529,6 +531,24 @@ public void transformedSuperClass() throws Exception {
jenkins.assertLogContains("OUTPUT: ybase", r);
}

@Ignore("Currently fails due to leaked executor")
@Issue("JENKINS-57253")
@Test
public void unexpectedBreakStatement() throws Exception {
WorkflowJob job = jenkins.createProject(WorkflowJob.class);
job.setDefinition(new CpsFlowDefinition("node {\n" +
" semaphore 'wait'\n" +
" break\n" +
"}\n", true));
assertEquals(0, jenkins.jenkins.toComputer().countBusy());
WorkflowRun b = job.scheduleBuild2(0).waitForStart();
SemaphoreStep.waitForStart("wait/1", b);
assertEquals(1, jenkins.jenkins.toComputer().countBusy());
SemaphoreStep.success("wait/1", null);
jenkins.assertBuildStatus(Result.FAILURE, jenkins.waitForCompletion(b));
assertEquals(0, jenkins.jenkins.toComputer().countBusy());
}

@Issue("SECURITY-1186")
@Test
public void finalizer() throws Exception {
Expand Down

0 comments on commit 926721c

Please sign in to comment.