diff --git a/src/core/Akka.API.Tests/LogFormatSpec.cs b/src/core/Akka.API.Tests/LogFormatSpec.cs index b778b8114b9..ccba7946a3e 100644 --- a/src/core/Akka.API.Tests/LogFormatSpec.cs +++ b/src/core/Akka.API.Tests/LogFormatSpec.cs @@ -107,19 +107,28 @@ await AwaitConditionAsync(() => // need to sanitize the thread id text = SanitizeDateTime(text); text = SanitizeThreadNumber(text); + // to resolve https://github.com/akkadotnet/akka.net/issues/7421 + text = SanitizeTestEventListener(text); await Verifier.Verify(text); } + + private static string SanitizeTestEventListener(string logs) + { + var pattern = @"^.*Akka\.TestKit\.TestEventListener.*$"; + var result = Regex.Replace(logs, pattern, string.Empty, RegexOptions.Multiline); + return result; + } - static string SanitizeThreadNumber(string log) + private static string SanitizeThreadNumber(string log) { - string pattern = @"(\[Thread )\d+(\])"; - string replacement = "[Thread 0001]"; - string result = Regex.Replace(log, pattern, replacement); + var pattern = @"(\[Thread )\d+(\])"; + var replacement = "[Thread 0001]"; + var result = Regex.Replace(log, pattern, replacement); return result; } - static string SanitizeDateTime(string logs, string replacement = "DateTime") + private static string SanitizeDateTime(string logs, string replacement = "DateTime") { // Regular expression to match the datetime string pattern = @"\[\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}\.\d{3}Z\]";