From 782626920acf700b621ab5d0f35503f302db8129 Mon Sep 17 00:00:00 2001 From: Cijo Thomas Date: Thu, 10 Feb 2022 12:03:46 -0800 Subject: [PATCH] Fix tests to avoid external dependency (#2884) --- .../HttpClientTests.Basic.netcore31.cs | 2 +- .../HttpClientTests.netcore31.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.netcore31.cs b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.netcore31.cs index 33c85c9277a..03fe66aae56 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.netcore31.cs +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.Basic.netcore31.cs @@ -354,7 +354,7 @@ public async Task HttpClientInstrumentationCorrelationAndBaggage() .Build()) { using var c = new HttpClient(); - using var r = await c.GetAsync("https://opentelemetry.io/").ConfigureAwait(false); + using var r = await c.GetAsync(this.url).ConfigureAwait(false); } Assert.Equal(5, activityProcessor.Invocations.Count); diff --git a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.netcore31.cs b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.netcore31.cs index a843e9fab4b..9620e10335a 100644 --- a/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.netcore31.cs +++ b/test/OpenTelemetry.Instrumentation.Http.Tests/HttpClientTests.netcore31.cs @@ -221,11 +221,11 @@ public async Task DebugIndividualTestAsync() [Fact] public async Task CheckEnrichmentWhenSampling() { - await CheckEnrichment(new AlwaysOffSampler(), 0).ConfigureAwait(false); - await CheckEnrichment(new AlwaysOnSampler(), 2).ConfigureAwait(false); + await CheckEnrichment(new AlwaysOffSampler(), 0, this.url).ConfigureAwait(false); + await CheckEnrichment(new AlwaysOnSampler(), 2, this.url).ConfigureAwait(false); } - private static async Task CheckEnrichment(Sampler sampler, int expect) + private static async Task CheckEnrichment(Sampler sampler, int expect, string url) { Counter = 0; var processor = new Mock>(); @@ -236,7 +236,7 @@ private static async Task CheckEnrichment(Sampler sampler, int expect) .Build()) { using var c = new HttpClient(); - using var r = await c.GetAsync("https://opentelemetry.io/").ConfigureAwait(false); + using var r = await c.GetAsync(url).ConfigureAwait(false); } Assert.Equal(expect, Counter);