Skip to content

Commit

Permalink
Prevent multiBranchPipelineIndex failure due to DirectoryNotEmptyExce…
Browse files Browse the repository at this point in the history
…ption (#2505)

* Skip flaky multiBranchPipelineIndex test

The test failed on a plugin bill of materials run for 2 of the 4 tested
configurations.  The failure message was a

Caused by: java.nio.file.DirectoryNotEmptyException: blueocean-pipeline-api-impl/target/tmp/j h2197780848444070882/jobs/p

This is a rather heavy-handed way to avoid the intermittent test failure,
since it will stop running the test in all environments, all the time.

The other tests in this class that use the runAllTests flag have used
it since 2016.  I didn't find any reference that indicated the tests
are enabled by any operation in the repository itself.  They might
be executed on a CI system that defines the RUN_MULTIBRANCH_TESTS
environment variable.

* Do not exit test until no activity

Avoid intermittent DirectoryNotEmptyException in the test by delaying
exit until Jenkins is quiet.

* Cancel pending jobs to reduce delay at test exit

---------

Co-authored-by: Olivier Lamy <[email protected]>
  • Loading branch information
MarkEWaite and olamy authored Sep 23, 2023
1 parent d1da0fb commit d95cf09
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ public void multiBranchPipelineIndex() throws Exception {
.build(Map.class);

assertNotNull(map);
// Cancel jobs in the queue so that waitUntilNoActivity waits less.
// Wait for activity to finish before exiting the test.
// Avoid intermittent failures from DirectoryNotEmptyException.
for (Queue.Item i : j.jenkins.getQueue().getItems()) {
j.jenkins.getQueue().cancel(i);
}
j.waitUntilNoActivity();
}


Expand Down

0 comments on commit d95cf09

Please sign in to comment.