Skip to content

Commit 3278e8b

Browse files
authored
eat There is no currently active test (#770)
1 parent 436eb0e commit 3278e8b

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

Diff for: tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs

+24-8
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,32 @@ public void Log<TState>(LogLevel level, EventId eventId, TState state, Exception
8484
throw new ArgumentNullException(nameof(formatter));
8585
}
8686

87-
TestOutput.WriteLine(string.Format(
88-
"[{0}] {1}: {2}",
89-
level,
90-
LoggerCategory,
91-
formatter(state, exception)));
87+
try
88+
{
89+
TestOutput.WriteLine(string.Format(
90+
"[{0}] {1}: {2}",
91+
level,
92+
LoggerCategory,
93+
formatter(state, exception)));
9294

93-
if (exception != null)
95+
if (exception != null)
96+
{
97+
TestOutput.WriteLine(
98+
exception.ToString());
99+
}
100+
}
101+
catch (AggregateException e)
94102
{
95-
TestOutput.WriteLine(
96-
exception.ToString());
103+
// ignore 'There is no currently active test.'
104+
foreach (var inner in e.InnerExceptions)
105+
{
106+
if (inner.Message.Contains("There is no currently active test"))
107+
{
108+
return;
109+
}
110+
}
111+
112+
throw;
97113
}
98114
}
99115

0 commit comments

Comments
 (0)