Skip to content

Commit 997c432

Browse files
committed
Flakes in WaitForBuildStepTest
Explicitly wait for the "wait" semaphore in downstream build, allowing the downstream build to go through full initialization. Otherwise in some case you'd run into a timing issue where downstream build is not aborted as expected. ``` 10.218 [id=211] WARNING o.j.p.w.cps.CpsFlowExecution#saveOwner: Error persisting Run ds#1 java.nio.channels.ClosedByInterruptException at java.base/java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:199) at java.base/sun.nio.ch.FileChannelImpl.endBlocking(FileChannelImpl.java:171) at java.base/sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:472) at hudson.util.AtomicFileWriter.commit(AtomicFileWriter.java:234) at hudson.XmlFile.write(XmlFile.java:221) at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30) at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1250) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.saveOwner(CpsFlowExecution.java:2124) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:622) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:446) 10.219 [us #1] [Pipeline] semaphore 10.219 [us #1] [Pipeline] waitForBuild 10.220 [us #1] Waiting for ds #1 to complete 10.220 [ds #1] [Pipeline] Start of Pipeline 10.241 [id=95] INFO o.j.p.w.t.s.SemaphoreStep$Execution#start: Blocking wait/1 10.270 [ds #1] [Pipeline] semaphore 180.002 [id=1] WARNING o.j.hudson.test.JenkinsRule$2#evaluate: Test timed out (after 180 seconds). [...] ```
1 parent ba84d21 commit 997c432

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/WaitForBuildStepTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public class WaitForBuildStepTest {
173173
SemaphoreStep.success("scheduled/1", true);
174174

175175
WorkflowRun dsRun = ds.getBuildByNumber(1);
176+
SemaphoreStep.waitForStart("wait/1", dsRun);
176177
waitForWaitForBuildAction(dsRun);
177178

178179
// Abort the downstream build
@@ -201,6 +202,7 @@ public class WaitForBuildStepTest {
201202
SemaphoreStep.success("scheduled/1", true);
202203

203204
WorkflowRun dsRun = ds.getBuildByNumber(1);
205+
SemaphoreStep.waitForStart("wait/1", dsRun);
204206
waitForWaitForBuildAction(dsRun);
205207

206208
// Abort the upstream build
@@ -229,6 +231,7 @@ public class WaitForBuildStepTest {
229231
SemaphoreStep.success("scheduled/1", true);
230232

231233
WorkflowRun dsRun = ds.getBuildByNumber(1);
234+
SemaphoreStep.waitForStart("wait/1", dsRun);
232235
waitForWaitForBuildAction(dsRun);
233236

234237
// Abort the upstream build

0 commit comments

Comments
 (0)