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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]