Skip to content

[Sampler.AWS] Fix flaky tests#4277

Merged
martincostello merged 1 commit intoopen-telemetry:mainfrom
martincostello:fix-flaky-aws-tests
Apr 22, 2026
Merged

[Sampler.AWS] Fix flaky tests#4277
martincostello merged 1 commit intoopen-telemetry:mainfrom
martincostello:fix-flaky-aws-tests

Conversation

@martincostello
Copy link
Copy Markdown
Member

Fixes #1219

Changes

  • Refactor to avoid test flakiness on disposal.
  • Enable test that now works on .NET Framework.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

- Refactor to avoid test flakiness on disposal.
- Enable test that now works on .NET Framework.

Resolves open-telemetry#1219.
@github-actions github-actions Bot added the comp:sampler.aws Things related to OpenTelemetry.Samplers.AWS label Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.85%. Comparing base (a545405) to head (a46b169).
⚠️ Report is 11 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4277   +/-   ##
=======================================
  Coverage   73.85%   73.85%           
=======================================
  Files         459      459           
  Lines       18327    18327           
=======================================
  Hits        13535    13535           
  Misses       4792     4792           
Flag Coverage Δ
unittests-Sampler.AWS 94.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello marked this pull request as ready for review April 22, 2026 09:25
@martincostello martincostello requested a review from a team as a code owner April 22, 2026 09:25
Copilot AI review requested due to automatic review settings April 22, 2026 09:25
@martincostello martincostello added this pull request to the merge queue Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 TestSamplerUpdateAndSample to async Task and replaces fixed Thread.Sleep waits with async waiting/polling.
  • Removes the NETFRAMEWORK skip 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.

Comment thread test/OpenTelemetry.Sampler.AWS.Tests/TestAWSXRayRemoteSampler.cs
Comment thread test/OpenTelemetry.Sampler.AWS.Tests/MockServerRequestHandler.cs
Merged via the queue into open-telemetry:main with commit 4ce72c5 Apr 22, 2026
77 checks passed
@martincostello martincostello deleted the fix-flaky-aws-tests branch April 22, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:sampler.aws Things related to OpenTelemetry.Samplers.AWS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Sampler.AWS] Unit tests are consistently failing in VS

3 participants