You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2025/06/24 17:57:46 UTC

[PR] generates unique names for mini IT dirs [accumulo]

keith-turner opened a new pull request, #5676:
URL: https://github.com/apache/accumulo/pull/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 multiple occasions, wasting developer time and build time.
   
   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-1750787155512-6711_SharedMiniClusterBase
   org.apache.accumulo.test.functional.ReadWriteIT-1750787009208-4495_interleaved
   org.apache.accumulo.test.functional.ReadWriteIT-1750787025424-3909_sunnyDay
   org.apache.accumulo.test.functional.ReadWriteIT-1750787058849-14476_largeTest
   org.apache.accumulo.test.functional.WALSunnyDayIT-1750787077639-32139_test
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] generates unique names for mini IT dirs [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5676:
URL: https://github.com/apache/accumulo/pull/5676#discussion_r2167817631


##########
test/src/main/java/org/apache/accumulo/harness/AccumuloITBase.java:
##########
@@ -90,7 +91,9 @@ public static File createTestDir(String name) {
     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();

Review Comment:
   There may be a few ITs that extend MiniClusterHarness or AccumuloClusterHarness directly, rather than extend AccumuloITBase or SharedMiniClusterBase. Those test dir names would be in AccumuloClusterHarness.createTestDir.



##########
test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java:
##########
@@ -141,14 +140,14 @@ public static synchronized void startMiniClusterWithConfig(
   }
 
   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");

Review Comment:
   Could probably just do `.orElseThrow()` here, since this really shouldn't happen.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] generates unique names for mini IT dirs [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner merged PR #5676:
URL: https://github.com/apache/accumulo/pull/5676


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] generates unique names for mini IT dirs [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on PR #5676:
URL: https://github.com/apache/accumulo/pull/5676#issuecomment-3001889785

   Moved the timestamp to the end of the dir name in f5a7084.  Looks like the following now.
   
   ```
   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
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org