Skip to content

Commit

Permalink
Fix o.o.transport.netty4.OpenSearchLoggingHandlerIT stack overflow te…
Browse files Browse the repository at this point in the history
…st failure (#1900)

Attempt to fix o.o.transport.netty4.OpenSearchLoggingHandlerIT fails w/ stack overflow by 
hardening test expectation patterns in regex patterns

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta committed Jan 14, 2022
1 parent 0f31d62 commit 6dcfe8c
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ public void tearDown() throws Exception {

@TestLogging(value = "org.opensearch.transport.netty4.OpenSearchLoggingHandler:trace,org.opensearch.transport.TransportLogger:trace", reason = "to ensure we log network events on TRACE level")
public void testLoggingHandler() {
final String writePattern = ".*\\[length: \\d+"
final String writePattern = "^.*\\[length: \\d+"
+ ", request id: \\d+"
+ ", type: request"
+ ", version: .*"
+ ", version: [^,]+"
+ ", header size: \\d+B"
+ ", action: cluster:monitor/nodes/hot_threads\\[n\\]\\]"
+ " WRITE: \\d+B";
+ " WRITE: \\d+B$";
final MockLogAppender.LoggingExpectation writeExpectation = new MockLogAppender.PatternSeenEventExpectation(
"hot threads request",
TransportLogger.class.getCanonicalName(),
Expand All @@ -86,12 +87,12 @@ public void testLoggingHandler() {
"*FLUSH*"
);

final String readPattern = ".*\\[length: \\d+"
final String readPattern = "^.*\\[length: \\d+"
+ ", request id: \\d+"
+ ", type: request"
+ ", version: .*"
+ ", version: [^,]+"
+ ", action: cluster:monitor/nodes/hot_threads\\[n\\]\\]"
+ " READ: \\d+B";
+ " READ: \\d+B$";

final MockLogAppender.LoggingExpectation readExpectation = new MockLogAppender.PatternSeenEventExpectation(
"hot threads request",
Expand Down

0 comments on commit 6dcfe8c

Please sign in to comment.