Skip to content

Commit

Permalink
Merge pull request #502 from jglick/WorkflowRunTest.logRotationOnlyPr…
Browse files Browse the repository at this point in the history
…ocessesCompletedBuilds

Flaky `WorkflowRunTest.logRotationOnlyProcessesCompletedBuilds` on Windows
  • Loading branch information
jglick authored Jan 15, 2025
2 parents 8a6fadd + 6ce8e85 commit 8a84adf
Showing 1 changed file with 12 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 All @@ -48,6 +47,7 @@
import hudson.AbortException;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.Functions;
import hudson.XmlFile;
import hudson.model.*;
import hudson.model.listeners.RunListener;
Expand Down Expand Up @@ -99,6 +99,7 @@
import org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty;
import org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction;
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import static org.junit.Assume.assumeFalse;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
Expand Down Expand Up @@ -697,6 +698,7 @@ public void onInitialize(Run run) {

@Issue("JENKINS-73835")
@Test public void logRotationOnlyProcessesCompletedBuilds() throws Throwable {
assumeFalse("TODO #502: failing in VMs", Functions.isWindows() && "true".equals(System.getenv("CI")));

Check warning on line 701 in src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: #502: failing in VMs", Functions.isWindows() && "true".equals(System.getenv("CI")));
logging.record(LogRotator.class, Level.FINER);
var p = r.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition(
Expand Down Expand Up @@ -725,11 +727,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 8a84adf

Please sign in to comment.