Skip to content

fix: fix flaky TestAsyncTransport_FlushWithContext#1222

Merged
giortzisg merged 1 commit intomasterfrom
fix/flaky-async-test
Mar 9, 2026
Merged

fix: fix flaky TestAsyncTransport_FlushWithContext#1222
giortzisg merged 1 commit intomasterfrom
fix/flaky-async-test

Conversation

@giortzisg
Copy link
Contributor

@giortzisg giortzisg commented Mar 9, 2026

Description

Fix flaky TestAsyncTransport_FlushWithContext/timeout test.

The test was racy because it relied on timing to trigger a context cancellation:

  • A context with a 1ns timeout was created, followed by a 10ms sleep to "ensure" expiry
  • No envelope was sent, so the queue was empty
  • When FlushWithContext was called, the worker could receive the flush request and drain the empty queue instantly, closing flushResponse, before the select evaluated ctx.Done()
  • select would randomly pick between two true statements

The fix sends an envelope and makes the test server block indefinitely, so the flush can never complete within the context deadline.

Issues

#skip-changelog

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@giortzisg giortzisg requested a review from Litarnus March 9, 2026 13:05
@giortzisg giortzisg self-assigned this Mar 9, 2026
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@giortzisg giortzisg force-pushed the fix/flaky-async-test branch from abffcf6 to ef04b40 Compare March 9, 2026 13:07
@giortzisg giortzisg requested a review from lcian March 9, 2026 13:11
@giortzisg giortzisg changed the title fix: fix flaky async test fix: fix flaky TestAsyncTransport_FlushWithContext Mar 9, 2026
@giortzisg giortzisg merged commit bf26e9a into master Mar 9, 2026
19 checks passed
@giortzisg giortzisg deleted the fix/flaky-async-test branch March 9, 2026 13:19
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