[Sampler.AWS] Fix flaky tests#4277
Conversation
- Refactor to avoid test flakiness on disposal. - Enable test that now works on .NET Framework. Resolves open-telemetry#1219.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4277 +/- ##
=======================================
Coverage 73.85% 73.85%
=======================================
Files 459 459
Lines 18327 18327
=======================================
Hits 13535 13535
Misses 4792 4792
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses flakiness in OpenTelemetry.Sampler.AWS tests (issue #1219) by making the mock HTTP server interactions and polling-based assertions more resilient, and by enabling a previously skipped .NET Framework test.
Changes:
- Refactors test server handler wiring (method-group) and response writing/closing behavior to reduce disposal-related flakiness.
- Converts
TestSamplerUpdateAndSampletoasync Taskand replaces fixedThread.Sleepwaits with async waiting/polling. - Removes the
NETFRAMEWORKskip so the sampler update test runs on .NET Framework again.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/OpenTelemetry.Sampler.AWS.Tests/TestAWSXRaySamplerClient.cs | Uses method-group delegate for the test HTTP server handler. |
| test/OpenTelemetry.Sampler.AWS.Tests/TestAWSXRayRemoteSampler.cs | Re-enables .NET Framework test; replaces sleeps with async delay and adds polling to reduce timing flakiness. |
| test/OpenTelemetry.Sampler.AWS.Tests/MockServerRequestHandler.cs | Adds try/finally to ensure responses are closed; uses leaveOpen writer to avoid stream disposal issues. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #1219
Changes
Merge requirement checklist
AppropriateCHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)