Skip to content

Commit

Permalink
[JENKINS-26399] JenkinsRuleExt.waitForCompletion/Message
Browse files Browse the repository at this point in the history
Originally-Committed-As: fac5ce62db53f18cabb2347f0bb6ae9e3f3ea1f9
  • Loading branch information
jglick committed Mar 18, 2015
1 parent 48d5b7b commit 284d595
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -26,11 +26,14 @@

import hudson.model.Result;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
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 static org.junit.Assert.*;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.Rule;
import org.junit.runners.model.Statement;
Expand All @@ -40,6 +43,7 @@
@Issue("JENKINS-26834")
public class RunWrapperTest {

@ClassRule public static BuildWatcher buildWatcher = new BuildWatcher();
@Rule public RestartableJenkinsRule r = new RestartableJenkinsRule();

@Test public void historyAndPickling() {
Expand All @@ -59,8 +63,7 @@ public class RunWrapperTest {
WorkflowRun b2 = p.scheduleBuild2(0).getStartCondition().get();
SemaphoreStep.success("basics/2", null);
SemaphoreStep.waitForStart("basics/3", b2);
Thread.sleep(1000); // TODO why is this necessary? the flush() in WorkflowRun.logNodeMessage apparently does not suffice
r.j.assertLogContains("number=2 result=null", b2);
JenkinsRuleExt.waitForMessage("number=2 result=null", b2);
r.j.assertLogNotContains("number=1", b2);
}
});
Expand All @@ -69,10 +72,7 @@ public class RunWrapperTest {
WorkflowJob p = r.j.jenkins.getItemByFullName("p", WorkflowJob.class);
WorkflowRun b2 = p.getBuildByNumber(2);
SemaphoreStep.success("basics/3", b2);
while (b2.isBuilding()) {
Thread.sleep(100);
}
r.j.assertBuildStatusSuccess(b2);
r.j.assertBuildStatusSuccess(JenkinsRuleExt.waitForCompletion(b2));
r.j.assertLogContains("number=1 result=SUCCESS", b2);
}
});
Expand Down

0 comments on commit 284d595

Please sign in to comment.