|
25 | 25 | package org.jenkinsci.plugins.workflow.job;
|
26 | 26 |
|
27 | 27 | import static org.awaitility.Awaitility.await;
|
28 |
| -import static org.hamcrest.collection.IsEmptyCollection.empty; |
29 | 28 | import static org.hamcrest.MatcherAssert.assertThat;
|
30 | 29 | import static org.hamcrest.Matchers.containsString;
|
31 |
| -import static org.hamcrest.Matchers.emptyArray; |
| 30 | +import static org.hamcrest.Matchers.empty; |
32 | 31 | import static org.hamcrest.Matchers.equalTo;
|
33 | 32 | import static org.hamcrest.Matchers.is;
|
34 | 33 | import static org.hamcrest.Matchers.notNullValue;
|
|
48 | 47 | import hudson.AbortException;
|
49 | 48 | import hudson.Extension;
|
50 | 49 | import hudson.ExtensionList;
|
| 50 | +import hudson.Functions; |
51 | 51 | import hudson.XmlFile;
|
52 | 52 | import hudson.model.*;
|
53 | 53 | import hudson.model.listeners.RunListener;
|
|
99 | 99 | import org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty;
|
100 | 100 | import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction;
|
101 | 101 | import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
|
| 102 | +import static org.junit.Assume.assumeFalse; |
102 | 103 | import org.junit.ClassRule;
|
103 | 104 | import org.junit.Ignore;
|
104 | 105 | import org.junit.Rule;
|
@@ -697,6 +698,7 @@ public void onInitialize(Run run) {
|
697 | 698 |
|
698 | 699 | @Issue("JENKINS-73835")
|
699 | 700 | @Test public void logRotationOnlyProcessesCompletedBuilds() throws Throwable {
|
| 701 | + assumeFalse("TODO #502: failing in VMs", Functions.isWindows() && "true".equals(System.getenv("CI"))); |
700 | 702 | logging.record(LogRotator.class, Level.FINER);
|
701 | 703 | var p = r.createProject(WorkflowJob.class);
|
702 | 704 | p.setDefinition(new CpsFlowDefinition(
|
@@ -725,11 +727,14 @@ public void onInitialize(Run run) {
|
725 | 727 | }
|
726 | 728 | LOGGER.info("Checking that all build directories are empty");
|
727 | 729 | for (int i = 0; i < buildsToRun; i++) {
|
728 |
| - String[] filesInBuildDir = buildDirs[i].list(); |
729 |
| - if (filesInBuildDir == null) { |
730 |
| - filesInBuildDir = new String[0]; |
731 |
| - } |
732 |
| - assertThat("Expected " + buildDirs[i] + " to be empty but saw: " + Arrays.toString(filesInBuildDir), filesInBuildDir, emptyArray()); |
| 730 | + var dir = buildDirs[i]; |
| 731 | + await(dir + " should be empty").until(() -> { |
| 732 | + var filesInBuildDir = dir.list(); |
| 733 | + if (filesInBuildDir == null) { |
| 734 | + filesInBuildDir = new String[0]; |
| 735 | + } |
| 736 | + return Arrays.asList(filesInBuildDir); |
| 737 | + }, empty()); |
733 | 738 | }
|
734 | 739 | }
|
735 | 740 |
|
|
0 commit comments