This is an automated email from the ASF dual-hosted git repository. kturner 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 dc19b16799 generates unique names for mini IT dirs (#5676) dc19b16799 is described below commit dc19b1679923c018b695c725de7dc7c11ac65a4f Author: Keith Turner <ktur...@apache.org> AuthorDate: Wed Jun 25 13:56:51 2025 -0400 generates unique names for mini IT dirs (#5676) This changes does two things. First it fixes a problem where when running SimpleSuite test directly their directory name would include UnknownITClass instead of the actual class name. Second it gives each mini test directory a unique name. This helps debug issues when the accumulo build reruns a flaky test. Before this change when that happened the logs of the first run of the flaky test were lost. This behavior has prevented debugging of issues the the multi hour build finds on multi [...] After this change the dirs in accumulo/test/target/mini-tests look like the following after running mvn clean verify -Psunny. ``` org.apache.accumulo.suites.SimpleSharedMacTestSuiteIT_SharedMiniClusterBase-1750799684935-27084 org.apache.accumulo.test.functional.ReadWriteIT_interleaved-1750799538393-661 org.apache.accumulo.test.functional.ReadWriteIT_largeTest-1750799588700-331 org.apache.accumulo.test.functional.ReadWriteIT_sunnyDay-1750799555105-5245 org.apache.accumulo.test.functional.WALSunnyDayIT_test-1750799607439-22076 ``` --- test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java | 5 ++++- .../java/org/apache/accumulo/harness/SharedMiniClusterBase.java | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java b/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java index c218f41c20..f6d1221d64 100644 --- a/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java +++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java @@ -19,6 +19,7 @@ package org.apache.accumulo.harness; import static com.google.common.collect.MoreCollectors.onlyElement; +import static org.apache.accumulo.core.util.LazySingletons.RANDOM; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -90,7 +91,9 @@ public class AccumuloITBase extends WithTestNames { if (name == null) { return baseDir; } - File testDir = baseDir.toPath().resolve(name).toFile(); + String uniqueName = String.format("%s-%d-%d", name, System.currentTimeMillis(), + RANDOM.get().nextInt(Short.MAX_VALUE)); + File testDir = baseDir.toPath().resolve(uniqueName).toFile(); FileUtils.deleteQuietly(testDir); assertTrue(testDir.mkdir()); return testDir; diff --git a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java index dd5fbde112..584382cb62 100644 --- a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java +++ b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java @@ -19,7 +19,6 @@ package org.apache.accumulo.harness; import static java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE; -import static org.apache.accumulo.core.util.LazySingletons.RANDOM; import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY; import java.io.File; @@ -141,14 +140,14 @@ public abstract class SharedMiniClusterBase extends AccumuloITBase implements Cl } private static String getTestClassName() { - Predicate<Class<?>> findITClass = c -> c.getSimpleName().endsWith("IT"); + Predicate<Class<?>> findITClass = + c -> c.getSimpleName().endsWith("IT") || c.getSimpleName().endsWith("SimpleSuite"); Function<Stream<StackFrame>,Optional<? extends Class<?>>> findCallerITClass = frames -> frames.map(StackFrame::getDeclaringClass).filter(findITClass).findFirst(); Optional<String> callerClassName = StackWalker.getInstance(RETAIN_CLASS_REFERENCE).walk(findCallerITClass).map(Class::getName); // use the calling class name, or default to a unique name if IT class can't be found - return callerClassName.orElse(String.format("UnknownITClass-%d-%d", System.currentTimeMillis(), - RANDOM.get().nextInt(Short.MAX_VALUE))); + return callerClassName.orElse("UnknownITClass"); } /**