-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a random ${test:logging.path}
#2954
base: 2.x
Are you sure you want to change the base?
Conversation
The `@TempLoggingDir` JUnit 5 extensions create a totally deterministic directory to hold the log files for tests. Since the directory is deleted only if all the tests succeed, this causes a problem with test reruns.
@@ -51,7 +51,8 @@ public void beforeAll(ExtensionContext context) throws Exception { | |||
Path loggingPath = null; | |||
for (final Field field : fields) { | |||
if (loggingPath != null) { | |||
StatusLogger.getLogger().warn("Multiple fields with @TempLoggingDir annotation are not supported."); | |||
StatusLogger.getLogger() | |||
.warn("Multiple static fields with @TempLoggingDir annotation are not supported."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're salting the generated paths, why not?
@@ -78,7 +79,8 @@ public void beforeEach(ExtensionContext context) throws Exception { | |||
final Object instance = context.getRequiredTestInstance(); | |||
for (final Field field : fields) { | |||
if (loggingPath != null) { | |||
StatusLogger.getLogger().warn("Multiple fields with @TempLoggingDir annotation are not supported."); | |||
StatusLogger.getLogger() | |||
.warn("Multiple instance fields with @TempLoggingDir annotation are not supported."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, why not?
// Create a temporary directory that uses the simple class name as prefix | ||
Path packagePath = basePath.resolve(dir); | ||
Files.createDirectories(packagePath); | ||
return Files.createTempDirectory(packagePath, clazz.getSimpleName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we suffix the path with something that will make directories lexicographically sorted by their creation time, please? For instance, timestamp + counter + salt
, etc.
The
@TempLoggingDir
JUnit 5 extensions create a totally deterministic directory to hold the log files for tests.Since the directory is deleted only if all the tests succeed, this causes a problem with test reruns.