Skip to content

Commit

Permalink
Fixed StackTrace replacement in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyte committed Apr 8, 2021
1 parent b6d71f2 commit a2d8c38
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.AggregateException\u0022,\u0022Message\u0022:\u0022AggregateException (Exception 0) (Exception 1) (Exception 2) (Exception 3) (Exception 4)\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 167\u0022,\u0022InnerExceptions\u0022:[{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception 0\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 159\u0022},{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception 1\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 159\u0022},{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception 2\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 159\u0022},{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception 3\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 159\u0022},{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception 4\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.AggregateExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 159\u0022},]}}"]]}]}
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.AggregateException\u0022,\u0022Message\u0022:\u0022AggregateException (Exception 0) (Exception 1) (Exception 2) (Exception 3) (Exception 4)\u0022,\u0022StackTrace<stack-trace>}}"]]}]}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.MessagePropertyForExceptionsWithoutMessageShouldNotBeCreated() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 116\u0022}}"]]}]}
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022StackTrace<stack-trace>}}"]]}]}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception message\u0022,\u0022StackTrace\u0022:\u0022 at Serilog.Sinks.Grafana.Loki.Tests.FormatterTests.LokiJsonTextFormatterTests.SimpleExceptionShouldBeSerializedCorrectly() in <path>\\\\Serilog.Sinks.Grafana.Loki\\\\test\\\\Serilog.Sinks.Grafana.Loki.Tests\\\\FormatterTests\\\\LokiJsonTextFormatterTests.cs:line 79\u0022}}"]]}]}
{"streams":[{"stream":{},"values":[["<unixepochinnanoseconds>","{\u0022Message\u0022:\u0022An error occured\u0022,\u0022MessageTemplate\u0022:\u0022An error occured\u0022,\u0022level\u0022:\u0022error\u0022,\u0022Exception\u0022:{\u0022Type\u0022:\u0022System.Exception\u0022,\u0022Message\u0022:\u0022Exception message\u0022,\u0022StackTrace<stack-trace>}}"]]}]}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void SimpleExceptionShouldBeSerializedCorrectly()
.Replace(s, "\"[0-9]{19}\"", "\"<unixepochinnanoseconds>\"");
return Regex.Replace(
s,
@"(?<=SimpleExceptionShouldBeSerializedCorrectly\(\) in )(.*?)(?=Serilog.Sinks.Grafana.Loki)",
@"<path>\\\\");
@"(?<=\\u0022StackTrace)(.*?)(?=}})",
@"<stack-trace>");
});
});
}
Expand Down Expand Up @@ -131,8 +131,8 @@ public void MessagePropertyForExceptionsWithoutMessageShouldNotBeCreated()
.Replace(s, "\"[0-9]{19}\"", "\"<unixepochinnanoseconds>\"");
return Regex.Replace(
s,
@"(?<=MessagePropertyForExceptionsWithoutMessageShouldNotBeCreated\(\) in )(.*?)(?=Serilog.Sinks.Grafana.Loki)",
@"<path>\\\\");
@"(?<=\\u0022StackTrace)(.*?)(?=}})",
@"<stack-trace>");
});
});
}
Expand Down Expand Up @@ -182,8 +182,8 @@ public void AggregateExceptionShouldBeSerializedCorrectly()
.Replace(s, "\"[0-9]{19}\"", "\"<unixepochinnanoseconds>\"");
return Regex.Replace(
s,
@"(?<=AggregateExceptionShouldBeSerializedCorrectly\(\) in )(.*?)(?=Serilog.Sinks.Grafana.Loki)",
@"<path>\\\\");
@"(?<=\\u0022StackTrace)(.*?)(?=}})",
@"<stack-trace>");
});
});
}
Expand Down

0 comments on commit a2d8c38

Please sign in to comment.