moving to dispose

This commit is contained in:
Eddy Nakamura 2020-11-03 21:50:17 -03:00
parent 31b15a427e
commit 01d41406b3
3 changed files with 15 additions and 15 deletions

View File

@ -236,11 +236,6 @@ namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
Assert.Equal(expectedTraceId, activity.Context.TraceId);
Assert.Equal(expectedSpanId, activity.ParentSpanId);
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
[Fact]
@ -338,6 +333,11 @@ namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
public void Dispose()
{
this.openTelemetrySdk?.Dispose();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
private static void WaitForProcessorInvocations(Mock<BaseProcessor<Activity>> activityProcessor, int invocationCount)

View File

@ -184,11 +184,6 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
Assert.Equal($"00/{activity.Context.TraceId}/{activity.Context.SpanId}/01", traceparents.Single());
Assert.Equal("k1=v1,k2=v2", tracestates.Single());
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
[Fact]
@ -321,6 +316,11 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
{
this.serverLifeTime?.Dispose();
Activity.Current = null;
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
private static void ActivityEnrichment(Activity activity, string method, object obj)

View File

@ -55,6 +55,11 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
public void Dispose()
{
this.serverLifeTime?.Dispose();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
[Fact]
@ -141,11 +146,6 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
Assert.Equal("k1=v1,k2=v2", tracestate);
parent.Stop();
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(new TextMapPropagator[]
{
new TraceContextPropagator(),
new BaggagePropagator(),
}));
}
[Fact]