Skip to content

fix(testutil): replace fixed sleep with polling for span flushing#488

Closed
pushkarscripts wants to merge 1 commit into
open-telemetry:mainfrom
pushkarscripts:polling-span-flush
Closed

fix(testutil): replace fixed sleep with polling for span flushing#488
pushkarscripts wants to merge 1 commit into
open-telemetry:mainfrom
pushkarscripts:polling-span-flush

Conversation

@pushkarscripts
Copy link
Copy Markdown
Contributor

Description

Replace fixed time.Sleep usage in span flushing helpers with polling-based readiness checks using require.Eventually.

Also improves trace logging so spans are only logged on assertion failures instead of every successful run.

Motivation

Fixed sleep-based synchronization can introduce flaky behavior in integration/E2E tests depending on system and CI timing.

This change makes span flushing checks more reliable while also reducing noisy test logs during successful runs.


Checklist

  • PR title follows conventional commits format
  • Code formatted: make format
  • Linters pass: make lint
  • Tests pass: make test
  • Tests added for new functionality
  • Tests follow testing guidelines
  • Documentation updated (if applicable)

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
@pushkarscripts pushkarscripts requested a review from a team as a code owner May 11, 2026 15:46
@github-actions github-actions Bot added the scope:fix A bug that is being fixed label May 11, 2026
@txabman42
Copy link
Copy Markdown
Contributor

Closing, as it's duplicated #463

However, the WaitForTCP refactor is good, feel free to open a PR with that improvement

@txabman42 txabman42 closed this May 12, 2026
txabman42 pushed a commit that referenced this pull request May 14, 2026
## Description

Replace the manual timeout loop in `WaitForTCP` with
`require.Eventuallyf` for polling-based TCP readiness checks.

## Motivation

This simplifies the readiness logic and keeps the polling behavior
consistent with other test synchronization helpers.

Follow-up extracted from #488.

---

## Checklist

- [x] PR title follows [conventional
commits](https://www.conventionalcommits.org/) format
- [x] Code formatted: `make format`
- [x] Linters pass: `make lint`
- [x] Tests pass: `make test`
- [ ] Tests added for new functionality
- [x] Tests follow [testing guidelines](docs/testing.md)
- [ ] Documentation updated (if applicable)

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:fix A bug that is being fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants