vy commented on code in PR #3957:
URL: https://github.com/apache/logging-log4j2/pull/3957#discussion_r2440072913
##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDeleteAccumulatedCount1Test.java:
##########
@@ -67,24 +71,37 @@ public void testAppender() throws Exception {
// 30 chars per message: each message triggers a rollover
logger.debug("This is a test message number " + i); // 30 chars:
}
- Thread.sleep(100); // Allow time for rollover to complete
final File dir = new File(DIR);
assertTrue("Dir " + DIR + " should exist", dir.exists());
- assertTrue("Dir " + DIR + " should contain files",
dir.listFiles().length > 0);
- final File[] files = dir.listFiles();
- for (final File file : files) {
- System.out.println(file + " (" + file.length() + "B) "
- +
FixedDateFormat.create(FixedFormat.ABSOLUTE).format(file.lastModified()));
- }
+ // Wait until the directory contents stabilize (no size change across
two polls)
Review Comment:
1. You don't need `Thread.sleep()`, you can remove it. (Awaitility already
polls.)
2. Don't wait until contents stabilize, instead, wait until what you want to
verify succeeds. That is, place the entire check logic there.
3. Sign all your commits
--
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]