You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2026/07/27 23:02:36 UTC

(maven-surefire) branch master updated: Follow up PR to cleanup directory (#3405)

This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/master by this push:
     new 16ce9c8a1 Follow up PR to cleanup directory (#3405)
16ce9c8a1 is described below

commit 16ce9c8a1f00b1b38663a329a518196952df53ed
Author: Olivier Lamy <ol...@apache.org>
AuthorDate: Tue Jul 28 09:02:31 2026 +1000

    Follow up PR to cleanup directory (#3405)
    
    Signed-off-by: Olivier Lamy <ol...@apache.org>
---
 .../surefire/booter/spi/CommandChannelDecoderTest.java    | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
index 38edf914b..5da6f4125 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java
@@ -28,12 +28,14 @@
 import java.util.Random;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.surefire.api.booter.Command;
 import org.apache.maven.surefire.api.booter.DumpErrorSingleton;
 import org.apache.maven.surefire.api.booter.Shutdown;
 import org.apache.maven.surefire.api.fork.ForkNodeArguments;
 import org.apache.maven.surefire.booter.ForkedNodeArg;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -61,17 +63,28 @@
 public class CommandChannelDecoderTest {
     private static final Random RND = new Random();
 
+    File reportsDir = new File("target", "decoder-dumps");
+
     @BeforeEach
     public void initTmpFile() {
         // Not a JUnit @TempDir: the decoder writes .dumpstream files into this directory,
         // and on Windows a freshly written file can be transiently locked (antivirus,
         // indexer) right when the @TempDir cleanup runs, failing the whole test class
         // with DirectoryNotEmptyException. target/ needs no post-test cleanup.
-        File reportsDir = new File("target", "decoder-dumps");
+
         String dumpFileName = "surefire-" + RND.nextLong();
         DumpErrorSingleton.getSingleton().init(reportsDir, dumpFileName);
     }
 
+    @AfterEach
+    public void cleanTmpFile() {
+        try {
+            FileUtils.deleteDirectory(reportsDir);
+        } catch (IOException e) {
+            // ignore
+        }
+    }
+
     @Test
     public void testDecoderRunClass() throws IOException {
         assertEquals(String.class, RUN_CLASS.getDataType());