Skip to content

Commit

Permalink
address corner case in test
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang committed Mar 6, 2021
1 parent b41ca42 commit c7b115f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/OpenTelemetry.Tests/Trace/ExceptionProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,24 @@ public void ActivityStatusSetToErrorWhenExceptionProcessorEnabled()
using (activity3 = activitySource.StartActivity("Activity3"))
{
}

activity5 = activitySource.StartActivity("Activity5");
}
finally
{
using (activity4 = activitySource.StartActivity("Activity4"))
{
}
}

try
{
throw new Exception("Oops!");
}
catch (Exception)
{
activity5 = activitySource.StartActivity("Activity5");
}
finally
{
activity5.Dispose();
}

Expand All @@ -77,7 +86,10 @@ public void ActivityStatusSetToErrorWhenExceptionProcessorEnabled()
Assert.Equal(StatusCode.Unset, activity4.GetStatus().StatusCode);
Assert.Null(activity4.GetTagValue("otel.exception_pointers"));
Assert.Equal(StatusCode.Unset, activity5.GetStatus().StatusCode);
#if !NETFRAMEWORK
// In this rare case, the following Activity tag will not get cleaned up due to perf consideration.
Assert.NotNull(activity5.GetTagValue("otel.exception_pointers"));
#endif
}

[Fact]
Expand Down

0 comments on commit c7b115f

Please sign in to comment.