Fix structured logging tests on Windows
See gh-5479
This commit is contained in:
@@ -70,12 +70,13 @@ class LogbackEcsStructuredLoggingFormatterTests extends AbstractStructuredLoggin
|
||||
.containsAllEntriesOf(map("error.type", "java.lang.RuntimeException", "error.message", "Boom"));
|
||||
String stackTrace = (String) deserialized.get("error.stack_trace");
|
||||
assertThat(stackTrace).startsWith(
|
||||
"""
|
||||
java.lang.RuntimeException: Boom
|
||||
\tat org.springframework.boot.logging.logback.LogbackEcsStructuredLoggingFormatterTests.shouldFormatException""");
|
||||
"java.lang.RuntimeException: Boom%n\tat org.springframework.boot.logging.logback.LogbackEcsStructuredLoggingFormatterTests.shouldFormatException"
|
||||
.formatted());
|
||||
assertThat(json).contains(
|
||||
"""
|
||||
java.lang.RuntimeException: Boom\\n\\tat org.springframework.boot.logging.logback.LogbackEcsStructuredLoggingFormatterTests.shouldFormatException""");
|
||||
"java.lang.RuntimeException: Boom%n\\tat org.springframework.boot.logging.logback.LogbackEcsStructuredLoggingFormatterTests.shouldFormatException"
|
||||
.formatted()
|
||||
.replace("\n", "\\n")
|
||||
.replace("\r", "\\r"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,12 +76,13 @@ class LogbackLogstashStructuredLoggingFormatterTests extends AbstractStructuredL
|
||||
Map<String, Object> deserialized = deserialize(json);
|
||||
String stackTrace = (String) deserialized.get("stack_trace");
|
||||
assertThat(stackTrace).startsWith(
|
||||
"""
|
||||
java.lang.RuntimeException: Boom
|
||||
\tat org.springframework.boot.logging.logback.LogbackLogstashStructuredLoggingFormatterTests.shouldFormatException""");
|
||||
"java.lang.RuntimeException: Boom%n\tat org.springframework.boot.logging.logback.LogbackLogstashStructuredLoggingFormatterTests.shouldFormatException"
|
||||
.formatted());
|
||||
assertThat(json).contains(
|
||||
"""
|
||||
java.lang.RuntimeException: Boom\\n\\tat org.springframework.boot.logging.logback.LogbackLogstashStructuredLoggingFormatterTests.shouldFormatException""");
|
||||
"java.lang.RuntimeException: Boom%n\\tat org.springframework.boot.logging.logback.LogbackLogstashStructuredLoggingFormatterTests.shouldFormatException"
|
||||
.formatted()
|
||||
.replace("\n", "\\n")
|
||||
.replace("\r", "\\r"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user