From 3278e8b418241e63dc13855a8d6ae8139d4b579c Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Wed, 26 Jan 2022 11:09:35 -0800 Subject: [PATCH] eat There is no currently active test (#770) --- .../Logging/TestOutputLogger.cs | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs b/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs index 06432cf..544970a 100644 --- a/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs +++ b/tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs @@ -84,16 +84,32 @@ namespace k8s.Tests.Logging throw new ArgumentNullException(nameof(formatter)); } - TestOutput.WriteLine(string.Format( - "[{0}] {1}: {2}", - level, - LoggerCategory, - formatter(state, exception))); - - if (exception != null) + try { - TestOutput.WriteLine( - exception.ToString()); + TestOutput.WriteLine(string.Format( + "[{0}] {1}: {2}", + level, + LoggerCategory, + formatter(state, exception))); + + if (exception != null) + { + TestOutput.WriteLine( + exception.ToString()); + } + } + catch (AggregateException e) + { + // 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; } }