From bec45d721cf2b872beec98aaf7a6327abe7fdaa8 Mon Sep 17 00:00:00 2001 From: Devin Nusbaum Date: Sat, 2 Nov 2024 09:25:23 -0400 Subject: [PATCH] Skip `LogRotatorTest#ableToDeleteCurrentBuild` on Windows (#9923) * Skip `LogRotatorTest#ableToDeleteCurrentBuild` on Windows * Also remove BuildWatcher from LogRotatorTest in case it was contributing to flakiness --- test/src/test/java/hudson/tasks/LogRotatorTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/src/test/java/hudson/tasks/LogRotatorTest.java b/test/src/test/java/hudson/tasks/LogRotatorTest.java index 118a860147a1..d30d4d8115bc 100644 --- a/test/src/test/java/hudson/tasks/LogRotatorTest.java +++ b/test/src/test/java/hudson/tasks/LogRotatorTest.java @@ -31,7 +31,9 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeFalse; +import hudson.Functions; import hudson.Launcher; import hudson.model.AbstractBuild; import hudson.model.BuildListener; @@ -50,10 +52,8 @@ import java.util.concurrent.TimeoutException; import java.util.logging.Level; import java.util.logging.Logger; -import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; -import org.jvnet.hudson.test.BuildWatcher; import org.jvnet.hudson.test.FailureBuilder; import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.JenkinsRule; @@ -64,9 +64,6 @@ */ public class LogRotatorTest { - @ClassRule - public static BuildWatcher watcher = new BuildWatcher(); - @Rule public JenkinsRule j = new JenkinsRule(); @@ -103,6 +100,8 @@ public void successVsFailureWithRemoveLastBuild() throws Exception { @Test public void ableToDeleteCurrentBuild() throws Exception { + assumeFalse("Deleting the current build while is is completing does not work consistently on Windows", + Functions.isWindows()); var p = j.createFreeStyleProject(); // Keep 0 builds, i.e. immediately delete builds as they complete. LogRotator logRotator = new LogRotator(-1, 0, -1, -1);