Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JENKINS-26399] JenkinsRuleExt.waitForCompletion/Message
Originally-Committed-As: fac5ce62db53f18cabb2347f0bb6ae9e3f3ea1f9
- Loading branch information
|
@@ -26,17 +26,21 @@ |
|
|
|
|
|
import hudson.Functions; |
|
|
import java.io.File; |
|
|
import org.jenkinsci.plugins.workflow.BuildWatcher; |
|
|
import org.jenkinsci.plugins.workflow.JenkinsRuleExt; |
|
|
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; |
|
|
import org.jenkinsci.plugins.workflow.job.WorkflowJob; |
|
|
import org.jenkinsci.plugins.workflow.job.WorkflowRun; |
|
|
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; |
|
|
import org.junit.ClassRule; |
|
|
import org.junit.Test; |
|
|
import org.junit.Rule; |
|
|
import org.junit.runners.model.Statement; |
|
|
import org.jvnet.hudson.test.RestartableJenkinsRule; |
|
|
|
|
|
public class PushdStepTest { |
|
|
|
|
|
@ClassRule public static BuildWatcher buildWatcher = new BuildWatcher(); |
|
|
@Rule public RestartableJenkinsRule story = new RestartableJenkinsRule(); |
|
|
|
|
|
private String pwdStep() { |
|
@@ -66,10 +70,7 @@ private String pwdStep() { |
|
|
@Override public void evaluate() throws Throwable { |
|
|
SemaphoreStep.success("restarting/1", null); |
|
|
WorkflowRun b = story.j.jenkins.getItemByFullName("p", WorkflowJob.class).getLastBuild(); |
|
|
while (b.isBuilding()) { // TODO JENKINS-26399 |
|
|
Thread.sleep(100); |
|
|
} |
|
|
story.j.assertLogContains(File.separator + "subdir", story.j.assertBuildStatusSuccess(b)); |
|
|
story.j.assertLogContains(File.separator + "subdir", story.j.assertBuildStatusSuccess(JenkinsRuleExt.waitForCompletion(b))); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
@@ -25,6 +25,8 @@ |
|
|
package org.jenkinsci.plugins.workflow.steps; |
|
|
|
|
|
import java.util.List; |
|
|
import org.jenkinsci.plugins.workflow.BuildWatcher; |
|
|
import org.jenkinsci.plugins.workflow.JenkinsRuleExt; |
|
|
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; |
|
|
import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution; |
|
|
import org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode; |
|
@@ -33,13 +35,15 @@ |
|
|
import org.jenkinsci.plugins.workflow.job.WorkflowRun; |
|
|
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep; |
|
|
import static org.junit.Assert.*; |
|
|
import org.junit.ClassRule; |
|
|
import org.junit.Rule; |
|
|
import org.junit.Test; |
|
|
import org.junit.runners.model.Statement; |
|
|
import org.jvnet.hudson.test.RestartableJenkinsRule; |
|
|
|
|
|
public class SleepStepTest { |
|
|
|
|
|
@ClassRule public static BuildWatcher buildWatcher = new BuildWatcher(); |
|
|
@Rule public RestartableJenkinsRule r = new RestartableJenkinsRule(); |
|
|
|
|
|
@Test public void sleepAndRestart() { |
|
@@ -61,10 +65,7 @@ |
|
|
@Override public void evaluate() throws Throwable { |
|
|
WorkflowJob p = r.j.jenkins.getItemByFullName("p", WorkflowJob.class); |
|
|
WorkflowRun b = p.getLastBuild(); |
|
|
while (b.isBuilding()) { |
|
|
Thread.sleep(100); |
|
|
} |
|
|
r.j.assertBuildStatusSuccess(b); |
|
|
r.j.assertBuildStatusSuccess(JenkinsRuleExt.waitForCompletion(b)); |
|
|
} |
|
|
}); |
|
|
} |
|
|