Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor OTLP mock collector test #3849

Merged

Conversation

alanwest
Copy link
Member

@alanwest alanwest commented Nov 1, 2022

Follow up from #3788 (comment)

}))
.StartAsync();

var httpClient = host.GetTestClient();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a normal httpclient, not the Test "httpclient"?

Copy link
Member Author

@alanwest alanwest Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we could. That's what we do in the Grpc.Net.Client tests https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcServer.cs#L71.

Do we have a preference? I kinda like the TestServer/TestClient as I think it makes the test code more concise. That is, I think it'd be required to find an open port, perform the ConfigureKestrel thing, etc. Not a huge deal, but it's extra noise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, you twisted my arm 😄. Still planning on addressing #3393, but this PR is good to go now.

I hard-coded ports for now making sure to use something that doesn't conflict with our other test with a hard-coded port

var res = await this.client.GetStringAsync("http://localhost:5000");

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #3849 (3bb9bd3) into main (91607e7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3849   +/-   ##
=======================================
  Coverage   87.34%   87.35%           
=======================================
  Files         279      279           
  Lines       10772    10772           
=======================================
+ Hits         9409     9410    +1     
+ Misses       1363     1362    -1     
Impacted Files Coverage Δ
src/OpenTelemetry/Metrics/AggregatorStore.cs 83.14% <100.00%> (ø)
...tation/OpenTelemetryProtocolExporterEventSource.cs 85.00% <0.00%> (-15.00%) ⬇️
...porter.OpenTelemetryProtocol/OtlpMetricExporter.cs 72.72% <0.00%> (-13.64%) ⬇️
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 97.65% <0.00%> (+0.78%) ⬆️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 100.00% <0.00%> (+2.85%) ⬆️
src/OpenTelemetry/ProviderExtensions.cs 100.00% <0.00%> (+5.55%) ⬆️
...xporter.OpenTelemetryProtocol/OtlpTraceExporter.cs 88.46% <0.00%> (+7.69%) ⬆️
...entation/ExportClient/OtlpGrpcTraceExportClient.cs 92.85% <0.00%> (+14.28%) ⬆️

@alanwest alanwest marked this pull request as ready for review November 4, 2022 22:06
@alanwest alanwest requested a review from a team November 4, 2022 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants