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

DomGarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 9ea3badb55 Write minicluster unit test cluster dirs to 
target/mini-tests so CI keeps their logs (#6558)
9ea3badb55 is described below

commit 9ea3badb5503fc900b44f7d1612c8d6fa451c2bb
Author: Dom G. <[email protected]>
AuthorDate: Tue Sep 29 11:47:16 2026 -0400

    Write minicluster unit test cluster dirs to target/mini-tests so CI keeps 
their logs (#6558)
---
 .../MiniAccumuloClusterClasspathTest.java          |  4 +--
 .../MiniAccumuloClusterExistingZooKeepersTest.java | 12 ++-----
 .../MiniAccumuloClusterStartStopTest.java          | 13 ++-----
 .../minicluster/MiniAccumuloClusterTest.java       |  9 +++--
 .../apache/accumulo/minicluster/MiniTestDirs.java  | 40 ++++++++++++++++++++++
 .../MiniAccumuloClusterImplTest.java               | 11 +++---
 6 files changed, 53 insertions(+), 36 deletions(-)

diff --git 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java
index 88881dee9a..d12a266cf7 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java
@@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import java.io.File;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
@@ -64,8 +63,7 @@ public class MiniAccumuloClusterClasspathTest extends 
WithTestNames {
 
   @BeforeAll
   public static void setupMiniCluster() throws Exception {
-    Path testDir = tempDir.resolve(MiniAccumuloClusterTest.class.getName());
-    Files.createDirectories(testDir);
+    Path testDir = 
MiniTestDirs.createTestDir(MiniAccumuloClusterClasspathTest.class.getName());
 
     jarFile = tempDir.resolve("iterator.jar").toFile();
     
FileUtils.copyURLToFile(requireNonNull(MiniAccumuloClusterClasspathTest.class
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterExistingZooKeepersTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterExistingZooKeepersTest.java
index 686ba2afa0..4a5b2cccd7 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterExistingZooKeepersTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterExistingZooKeepersTest.java
@@ -20,10 +20,8 @@ package org.apache.accumulo.minicluster;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.IOException;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Map;
 
@@ -39,26 +37,20 @@ import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.TestingServer;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not 
set by user input")
 public class MiniAccumuloClusterExistingZooKeepersTest extends WithTestNames {
 
-  @TempDir
-  private static Path tempDir;
-
   private static final String SECRET = "superSecret";
 
   private MiniAccumuloConfig config;
 
   @BeforeEach
   public void setupTestCluster() throws IOException {
-    assertTrue(Files.isDirectory(tempDir));
-    final Path perTestCaseSubDir = tempDir.resolve(testName());
-    Files.deleteIfExists(perTestCaseSubDir);
-    Files.createDirectories(perTestCaseSubDir);
+    final Path perTestCaseSubDir =
+        MiniTestDirs.createTestDir(getClass().getName() + "_" + testName());
 
     // disable adminServer, which runs on port 8080 by default and we don't 
need
     System.setProperty("zookeeper.admin.enableServer", "false");
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java
index 976e85a2c3..33a847ba42 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterStartStopTest.java
@@ -18,10 +18,7 @@
  */
 package org.apache.accumulo.minicluster;
 
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
 import java.io.IOException;
-import java.nio.file.Files;
 import java.nio.file.Path;
 
 import org.apache.accumulo.core.client.Accumulo;
@@ -29,7 +26,6 @@ import org.apache.accumulo.core.client.AccumuloClient;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,17 +36,12 @@ public class MiniAccumuloClusterStartStopTest extends 
WithTestNames {
 
   private static final Logger log = 
LoggerFactory.getLogger(MiniAccumuloClusterStartStopTest.class);
 
-  @TempDir
-  private static Path tempDir;
-
   private MiniAccumuloCluster accumulo;
 
   @BeforeEach
   public void setupTestCluster() throws IOException {
-    assertTrue(Files.isDirectory(tempDir));
-    final Path perTestCaseSubDir = tempDir.resolve(testName());
-    Files.deleteIfExists(perTestCaseSubDir);
-    Files.createDirectories(perTestCaseSubDir);
+    final Path perTestCaseSubDir =
+        MiniTestDirs.createTestDir(getClass().getName() + "_" + testName());
     accumulo = new MiniAccumuloCluster(perTestCaseSubDir.toFile(), 
"superSecret");
   }
 
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index 5b4b2b521e..6ccaad4b86 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -56,7 +56,6 @@ import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.io.TempDir;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
@@ -66,15 +65,15 @@ public class MiniAccumuloClusterTest extends WithTestNames {
   public static final String ROOT_PASSWORD = "superSecret";
   public static final String ROOT_USER = "root";
 
-  @TempDir
-  private static Path tempDir;
+  private static Path testDir;
 
   private static MiniAccumuloCluster accumulo;
 
   @BeforeAll
   public static void setupMiniCluster() throws Exception {
+    testDir = 
MiniTestDirs.createTestDir(MiniAccumuloClusterTest.class.getName());
     MiniAccumuloConfig config =
-        new MiniAccumuloConfig(tempDir.toFile(), 
ROOT_PASSWORD).setJDWPEnabled(true);
+        new MiniAccumuloConfig(testDir.toFile(), 
ROOT_PASSWORD).setJDWPEnabled(true);
     config.setZooKeeperPort(0);
     HashMap<String,String> site = new HashMap<>();
     site.put(Property.GENERAL_SERVER_WAL_SORT_BUFFER_SIZE.getKey(), "15%");
@@ -200,7 +199,7 @@ public class MiniAccumuloClusterTest extends WithTestNames {
 
   @Test
   public void testRandomPorts() throws Exception {
-    Path accumuloProps = 
tempDir.resolve("conf").resolve("accumulo.properties");
+    Path accumuloProps = 
testDir.resolve("conf").resolve("accumulo.properties");
     var config = new PropertiesConfiguration();
     try (var reader = Files.newBufferedReader(accumuloProps, UTF_8)) {
       config.read(reader);
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniTestDirs.java 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniTestDirs.java
new file mode 100644
index 0000000000..52d0006300
--- /dev/null
+++ 
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniTestDirs.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.minicluster;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.commons.io.FileUtils;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+// Trimmed copy of AccumuloITBase.createTestDir (can't depend on the test 
module). Keeps MAC
+// dirs under target/mini-tests so their logs still exist in case of failure 
for CI to upload.
+public class MiniTestDirs {
+
+  @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path 
provided by test")
+  public static Path createTestDir(String name) throws IOException {
+    Path testDir = Path.of(System.getProperty("user.dir") + 
"/target/mini-tests", name);
+    FileUtils.deleteQuietly(testDir.toFile());
+    return Files.createDirectories(testDir);
+  }
+
+}
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImplTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImplTest.java
index 306bab8544..1609e5708a 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImplTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImplTest.java
@@ -21,7 +21,6 @@ package org.apache.accumulo.miniclusterImpl;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import java.nio.file.Path;
 import java.util.Collection;
 import java.util.Map;
 
@@ -30,12 +29,12 @@ import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.MiniTestDirs;
 import org.apache.accumulo.minicluster.ServerType;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.io.TempDir;
 
 import com.google.common.collect.Iterators;
 
@@ -44,9 +43,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not 
set by user input")
 public class MiniAccumuloClusterImplTest {
 
-  @TempDir
-  private static Path tempDir;
-
   private static MiniAccumuloClusterImpl accumulo;
 
   private static final int NUM_TSERVERS = 2;
@@ -55,8 +51,9 @@ public class MiniAccumuloClusterImplTest {
 
   @BeforeAll
   public static void setupMiniCluster() throws Exception {
-    MiniAccumuloConfigImpl config =
-        new MiniAccumuloConfigImpl(tempDir.toFile(), 
"superSecret").setJDWPEnabled(true);
+    MiniAccumuloConfigImpl config = new MiniAccumuloConfigImpl(
+        
MiniTestDirs.createTestDir(MiniAccumuloClusterImplTest.class.getName()).toFile(),
+        "superSecret").setJDWPEnabled(true);
     // expressly set number of tservers since we assert it later, in case the 
default changes
     
config.getClusterServerConfiguration().setNumDefaultTabletServers(NUM_TSERVERS);
     accumulo = new MiniAccumuloClusterImpl(config);

Reply via email to