This is an automated email from the ASF dual-hosted git repository.
mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new f8abcb2d5d Disable flaky Windows tests
f8abcb2d5d is described below
commit f8abcb2d5d565545eccede2f432d8fd94ac41667
Author: Matt Sicker <[email protected]>
AuthorDate: Thu May 26 21:28:10 2022 -0500
Disable flaky Windows tests
- LOG4J2-3512 (and LOG4J2-3514)
- LOG4J2-3513
- LOG4J2-3515
Signed-off-by: Matt Sicker <[email protected]>
---
...llAsyncLoggerConfigLoggingFromToStringTest.java | 56 +++++++++-------------
.../filter/MutableThreadContextMapFilterTest.java | 24 +++++-----
.../logging/log4j/core/time/ClockFactoryTest.java | 3 ++
3 files changed, 38 insertions(+), 45 deletions(-)
diff --git
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/QueueFullAsyncLoggerConfigLoggingFromToStringTest.java
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/QueueFullAsyncLoggerConfigLoggingFromToStringTest.java
index e5cbcab99c..22562e57a0 100644
---
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/QueueFullAsyncLoggerConfigLoggingFromToStringTest.java
+++
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/QueueFullAsyncLoggerConfigLoggingFromToStringTest.java
@@ -17,55 +17,46 @@
package org.apache.logging.log4j.core.async;
import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.core.test.categories.AsyncLoggers;
-import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
+import org.apache.logging.log4j.plugins.Named;
import org.apache.logging.log4j.status.StatusData;
import org.apache.logging.log4j.status.StatusLogger;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.CountDownLatch;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests queue full scenarios with AsyncLoggers in configuration.
*/
-@RunWith(BlockJUnit4ClassRunner.class)
-@Category(AsyncLoggers.class)
+@Tag("async")
+@DisabledOnOs(value = OS.WINDOWS, disabledReason =
"https://issues.apache.org/jira/browse/LOG4J2-3513")
public class QueueFullAsyncLoggerConfigLoggingFromToStringTest extends
QueueFullAbstractTest {
- @BeforeClass
+ @BeforeAll
public static void beforeClass() {
System.setProperty("AsyncLoggerConfig.RingBufferSize", "128");
- System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
- "log4j2-queueFullAsyncLoggerConfig.xml");
}
- @Rule
- public LoggerContextRule context = new LoggerContextRule(
- "log4j2-queueFullAsyncLoggerConfig.xml");
-
- @Before
- public void before() throws Exception {
- blockingAppender = context.getRequiredAppender("Blocking",
BlockingAppender.class);
- }
-
- @Test(timeout = 5000)
- public void testLoggingFromToStringCausesOutOfOrderMessages() throws
InterruptedException {
+ @Test
+ @LoggerContextSource(value = "log4j2-queueFullAsyncLoggerConfig.xml",
timeout = 5)
+ public void testLoggingFromToStringCausesOutOfOrderMessages(
+ final LoggerContext context, @Named("Blocking") final
BlockingAppender blockingAppender) {
+ this.blockingAppender = blockingAppender;
//TRACE = true;
- final Logger logger = LogManager.getLogger(this.getClass());
+ final Logger logger = context.getLogger(this.getClass());
blockingAppender.countDownLatch = new CountDownLatch(1);
unlocker = new Unlocker(new CountDownLatch(129)); // count slightly
different from "pure" async loggers
@@ -93,16 +84,15 @@ public class
QueueFullAsyncLoggerConfigLoggingFromToStringTest extends QueueFull
final Stack<String> actual = transform(blockingAppender.logEvents);
assertEquals("Logging in toString() #0", actual.pop());
List<StatusData> statusDataList =
StatusLogger.getLogger().getStatusData();
- assertEquals("Jumped the queue: queue full",
- "Logging in toString() #128", actual.pop());
+ assertEquals("Logging in toString() #128", actual.pop(), "Jumped the
queue: queue full");
StatusData mostRecentStatusData =
statusDataList.get(statusDataList.size() - 1);
- assertEquals("Expected warn level status message", Level.WARN,
mostRecentStatusData.getLevel());
+ assertEquals(Level.WARN, mostRecentStatusData.getLevel(), "Expected
warn level status message");
assertThat(mostRecentStatusData.getFormattedStatus(), containsString(
"Log4j2 logged an event out of order to prevent deadlock
caused by domain " +
"objects logging from their toString method when the
async queue is full"));
for (int i = 1; i < 128; i++) {
- assertEquals("First batch", "Logging in toString() #" + i,
actual.pop());
+ assertEquals("Logging in toString() #" + i, actual.pop(), "First
batch");
}
assertEquals("logging naughty object #0 Who's bad?!", actual.pop());
assertTrue(actual.isEmpty());
diff --git
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/MutableThreadContextMapFilterTest.java
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/MutableThreadContextMapFilterTest.java
index ae34b1d45d..ea0df7fd72 100644
---
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/MutableThreadContextMapFilterTest.java
+++
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/MutableThreadContextMapFilterTest.java
@@ -16,14 +16,6 @@
*/
package org.apache.logging.log4j.core.filter;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.core.Appender;
@@ -33,15 +25,23 @@ import
org.apache.logging.log4j.core.test.appender.ListAppender;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Unit test for simple App.
*/
+@DisabledOnOs(value = OS.WINDOWS, disabledReason =
"https://issues.apache.org/jira/browse/LOG4J2-3512")
public class MutableThreadContextMapFilterTest implements
MutableThreadContextMapFilter.FilterConfigUpdateListener {
static final String CONFIG = "log4j2-mutableFilter.xml";
diff --git
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
index 1f36e11468..3e10ee30e6 100644
---
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
+++
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
@@ -23,9 +23,12 @@ import org.apache.logging.log4j.plugins.di.DI;
import org.apache.logging.log4j.plugins.di.Injector;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import static org.assertj.core.api.Assertions.assertThat;
+@DisabledOnOs(value = OS.WINDOWS, disabledReason =
"https://issues.apache.org/jira/browse/LOG4J2-3515")
public class ClockFactoryTest {
private final Injector injector = DI.createInjector();