You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2026/06/29 09:33:33 UTC
(logging-log4j2) 02/02: Stabilize `RollingAppenderDirectCronTest`
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch rollMaxRandomDelay
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit c7ccdbaff538b400a89b2cbe49b3d698ddd5a2a4
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Mon Jun 29 11:33:22 2026 +0200
Stabilize `RollingAppenderDirectCronTest`
---
.../core/appender/rolling/RollingAppenderDirectCronTest.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectCronTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectCronTest.java
index 444016dfd1..a1fbe28ff6 100644
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectCronTest.java
+++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/RollingAppenderDirectCronTest.java
@@ -50,10 +50,10 @@ class RollingAppenderDirectCronTest {
@LoggerContextSource("classpath:appender/rolling/RollingAppenderDirectCronTest.xml")
void testAppender(final LoggerContext ctx, @Named("RollingFile") final RollingFileAppender app) throws Exception {
final Logger logger = ctx.getLogger(RollingAppenderDirectCronTest.class);
+ final RolloverDelay delay = new RolloverDelay(app.getManager());
int msgNumber = 1;
logger.debug("This is test message number {}.", msgNumber++);
assertThat(loggingPath).isNotEmptyDirectory();
- final RolloverDelay delay = new RolloverDelay(app.getManager());
delay.waitForRollover();
delay.reset(3);
@@ -100,11 +100,11 @@ class RollingAppenderDirectCronTest {
final Path path = Paths.get(fileName);
final Matcher matcher = FILE_PATTERN.matcher(path.getFileName().toString());
assertThat(matcher).as("Rolled file").matches();
- waitAtMost(2, TimeUnit.SECONDS).untilAsserted(() -> {
- final List<String> lines = Files.readAllLines(path);
- assertThat(lines).isNotEmpty();
- assertThat(lines.get(0)).startsWith(matcher.group(1));
- });
+ final List<String> lines = Files.readAllLines(path);
+ if (lines.isEmpty()) {
+ return;
+ }
+ assertThat(lines.get(0)).startsWith(matcher.group(1));
latch.countDown();
} catch (final Exception ex) {
verificationFailure =