Skip to content

Commit

Permalink
eat There is no currently active test (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
tg123 authored Jan 26, 2022
1 parent 436eb0e commit 3278e8b
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,32 @@ public void Log<TState>(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;
}
}

Expand Down

0 comments on commit 3278e8b

Please sign in to comment.