diff --git a/pom.xml b/pom.xml index cfb5a5bbb..1b341f09f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.jenkins-ci.plugins plugin - 3.43 + 3.54 org.jenkins-ci.plugins.workflow diff --git a/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpActionTest.java b/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpActionTest.java index bc59ce34e..fa38bab08 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpActionTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpActionTest.java @@ -25,6 +25,8 @@ package org.jenkinsci.plugins.workflow.cps; import static org.hamcrest.Matchers.*; + +import hudson.model.queue.QueueTaskFuture; import org.jenkinsci.plugins.workflow.job.WorkflowJob; import org.jenkinsci.plugins.workflow.job.WorkflowRun; import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; @@ -40,11 +42,13 @@ public class CpsThreadDumpActionTest { @Test public void doProgramDotXml() throws Exception { WorkflowJob p = r.createProject(WorkflowJob.class); p.setDefinition(new CpsFlowDefinition("node {semaphore 'wait'}", true)); - WorkflowRun b = p.scheduleBuild2(0).waitForStart(); + final QueueTaskFuture f = p.scheduleBuild2(0); + WorkflowRun b = f.waitForStart(); SemaphoreStep.waitForStart("wait/1", b); String xml = r.createWebClient().goTo(b.getUrl() + b.getAction(CpsThreadDumpAction.class).getUrlName() + "/program.xml", "text/xml").getWebResponse().getContentAsString(); System.out.println(xml); assertThat(xml, containsString("SemaphoreStep")); + SemaphoreStep.success("wait/1", null); + r.assertBuildStatusSuccess(f); } - } diff --git a/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpTest.java b/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpTest.java index 554fa2729..d964b2415 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpTest.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import static java.util.Arrays.asList; import java.util.List; + +import hudson.model.queue.QueueTaskFuture; import org.apache.commons.lang.StringUtils; import org.jenkinsci.plugins.workflow.cps.CpsThreadDump.ThreadInfo; import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner; @@ -81,7 +83,8 @@ public void parallel() throws Exception { "}", "zot()" // 10 ), "\n"), false)); - WorkflowRun b = p.scheduleBuild2(0).waitForStart(); + final QueueTaskFuture f = p.scheduleBuild2(0); + WorkflowRun b = f.waitForStart(); SemaphoreStep.waitForStart("x/1", b); SemaphoreStep.waitForStart("y/1", b); @@ -101,12 +104,17 @@ public void parallel() throws Exception { "DSL.semaphore(waiting on y/1)", "WorkflowScript.bar(WorkflowScript:3)", "WorkflowScript.zot(WorkflowScript:8)"); + + SemaphoreStep.success("x/1", null); + SemaphoreStep.success("y/1", null); + j.assertBuildStatusSuccess(f); } @Test public void load() throws Exception { j.jenkins.getWorkspaceFor(p).child("lib.groovy").write("def m() {semaphore 'here'}; this", null); p.setDefinition(new CpsFlowDefinition("def lib; node {lib = load 'lib.groovy'}; lib.m()", true)); - WorkflowRun b = p.scheduleBuild2(0).waitForStart(); + final QueueTaskFuture f = p.scheduleBuild2(0); + WorkflowRun b = f.waitForStart(); SemaphoreStep.waitForStart("here/1", b); CpsThreadDump td = b.getAction(CpsThreadDumpAction.class).threadDumpSynchronous(); td.print(System.out); @@ -114,6 +122,8 @@ public void parallel() throws Exception { "DSL.semaphore(waiting on here/1)", "Script1.m(Script1.groovy:1)", "WorkflowScript.run(WorkflowScript:1)"); + SemaphoreStep.success("here/1", null); + j.assertBuildStatusSuccess(f); } @Test public void nativeMethods() throws Exception {