Skip to content

Commit 15c2e59

Browse files
Scope ActivityListener in test to not interfere with other tests (#40044)
Might fix #34072 Co-authored-by: Brennan <[email protected]>
1 parent 272fd90 commit 15c2e59

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,12 @@ public void ActivityOnImportHookIsCalled()
498498
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/40038")]
499499
public void ActivityListenersAreCalled()
500500
{
501-
var hostingApplication = CreateApplication(out var features);
501+
var testSource = new ActivitySource(Path.GetRandomFileName());
502+
var hostingApplication = CreateApplication(out var features, activitySource: testSource);
502503
var parentSpanId = "";
503504
using var listener = new ActivityListener
504505
{
505-
ShouldListenTo = activitySource => true,
506+
ShouldListenTo = activitySource => ReferenceEquals(activitySource, testSource),
506507
Sample = (ref ActivityCreationOptions<ActivityContext> _) => ActivitySamplingResult.AllData,
507508
ActivityStarted = activity =>
508509
{

0 commit comments

Comments
 (0)