Skip to content

Commit

Permalink
Flaky WorkflowRunTest.logRotationOnlyProcessesCompletedBuilds on Wi…
Browse files Browse the repository at this point in the history
…ndows
  • Loading branch information
jglick committed Jan 14, 2025
1 parent 8a6fadd commit 252368c
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
package org.jenkinsci.plugins.workflow.job;

import static org.awaitility.Awaitility.await;
import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
Expand Down Expand Up @@ -725,11 +724,14 @@ public void onInitialize(Run run) {
}
LOGGER.info("Checking that all build directories are empty");
for (int i = 0; i < buildsToRun; i++) {
String[] filesInBuildDir = buildDirs[i].list();
if (filesInBuildDir == null) {
filesInBuildDir = new String[0];
}
assertThat("Expected " + buildDirs[i] + " to be empty but saw: " + Arrays.toString(filesInBuildDir), filesInBuildDir, emptyArray());
var dir = buildDirs[i];
await(dir + " should be empty").until(() -> {
var filesInBuildDir = dir.list();
if (filesInBuildDir == null) {
filesInBuildDir = new String[0];
}
return Arrays.asList(filesInBuildDir);
}, empty());
}
}

Expand Down

0 comments on commit 252368c

Please sign in to comment.