diff --git a/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs b/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs index 06432cfb..544970a8 100644 --- a/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs +++ b/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs @@ -84,16 +84,32 @@ public void Log(LogLevel level, EventId eventId, TState state, Exception throw new ArgumentNullException(nameof(formatter)); } - TestOutput.WriteLine(string.Format( - "[{0}] {1}: {2}", - level, - LoggerCategory, - formatter(state, exception))); + try + { + TestOutput.WriteLine(string.Format( + "[{0}] {1}: {2}", + level, + LoggerCategory, + formatter(state, exception))); - if (exception != null) + if (exception != null) + { + TestOutput.WriteLine( + exception.ToString()); + } + } + catch (AggregateException e) { - TestOutput.WriteLine( - exception.ToString()); + // ignore 'There is no currently active test.' + foreach (var inner in e.InnerExceptions) + { + if (inner.Message.Contains("There is no currently active test")) + { + return; + } + } + + throw; } }