Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] [1.x] Attempt to fix o.o.transport.netty4.OpenSearchLoggingHandlerIT fails w/ stack overflow by hardening test expectation patterns in regex patterns #1906

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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