From bdaeeb4d1e2b70c4ba61d073c2e9e01161956653 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Mon, 31 Jan 2022 15:34:52 -0500 Subject: [PATCH] Another attempt to fix o.o.transport.netty4.OpenSearchLoggingHandlerIT fails w/ stack overflow Signed-off-by: Andriy Redko --- .../transport/netty4/OpenSearchLoggingHandlerIT.java | 1 + .../src/main/java/org/opensearch/test/MockLogAppender.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/transport/netty4/OpenSearchLoggingHandlerIT.java b/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/transport/netty4/OpenSearchLoggingHandlerIT.java index 4d029db812439..ea3f21dd0ed3b 100644 --- a/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/transport/netty4/OpenSearchLoggingHandlerIT.java +++ b/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/transport/netty4/OpenSearchLoggingHandlerIT.java @@ -53,6 +53,7 @@ public class OpenSearchLoggingHandlerIT extends OpenSearchNetty4IntegTestCase { public void setUp() throws Exception { super.setUp(); appender = MockLogAppender.createForLoggers( + "^[^\n]+$", /* Only consider single line log statements */ LogManager.getLogger(OpenSearchLoggingHandler.class), LogManager.getLogger(TransportLogger.class), LogManager.getLogger(TcpTransport.class) diff --git a/test/framework/src/main/java/org/opensearch/test/MockLogAppender.java b/test/framework/src/main/java/org/opensearch/test/MockLogAppender.java index 2dfbb54bb1861..328aaf8a65b1f 100644 --- a/test/framework/src/main/java/org/opensearch/test/MockLogAppender.java +++ b/test/framework/src/main/java/org/opensearch/test/MockLogAppender.java @@ -68,8 +68,12 @@ public class MockLogAppender extends AbstractAppender implements AutoCloseable { * write to a closed MockLogAppender instance. */ public static MockLogAppender createForLoggers(Logger... loggers) throws IllegalAccessException { + return createForLoggers(".*(\n.*)*", loggers); + } + + public static MockLogAppender createForLoggers(String filter, Logger... loggers) throws IllegalAccessException { final MockLogAppender appender = new MockLogAppender( - RegexFilter.createFilter(".*(\n.*)*", new String[0], false, null, null), + RegexFilter.createFilter(filter, new String[0], false, null, null), Collections.unmodifiableList(Arrays.asList(loggers)) ); appender.start();