Fix tests to avoid external dependency (#2884)

This commit is contained in:
Cijo Thomas 2022-02-10 12:03:46 -08:00 committed by GitHub
parent b1d57e9b0e
commit 782626920a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -354,7 +354,7 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
.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);

View File

@ -221,11 +221,11 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
[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<BaseProcessor<Activity>>();
@ -236,7 +236,7 @@ namespace OpenTelemetry.Instrumentation.Http.Tests
.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);