Skip to content

test(ldtestdata): increase channel-wait timeouts to reduce CI flakiness#420

Open
aaron-zeisler wants to merge 1 commit into
v7from
aaronz/fix-flaky-testflagtargets-timeout
Open

test(ldtestdata): increase channel-wait timeouts to reduce CI flakiness#420
aaron-zeisler wants to merge 1 commit into
v7from
aaronz/fix-flaky-testflagtargets-timeout

Conversation

@aaron-zeisler

@aaron-zeisler aaron-zeisler commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Increases hardcoded time.Millisecond channel-wait timeouts in testhelpers/ldtestdata to time.Second to fix intermittent CI flakiness.

Background

TestFlagTargets/user_targets intermittently failed in CI (observed on the Windows, Go 1.26 job) with:

channels.go:126: expected a mocks.UpsertParams value from channel but did not receive one in 1ms
channels.go:128: timed out before receiving expected update

Sibling jobs in the same CI run (Windows Go 1.24/1.25, all Linux jobs) passed with the identical test suite, confirming this is a timing flake rather than a real regression. Several test call sites in test_data_source_flag_test.go and test_data_source_test.go pass a hardcoded time.Millisecond timeout to WaitForUpsert/WaitForInit/WaitForNextInit/AssertChannelClosed, which wait on a channel populated by a producer goroutine. Under go test -race on slower/jitterier runners, 1ms isn't enough margin. This pattern dates back to a 2020 commit and has just been latent until now.

No behavior change is intended — only the timeout values increase, so tests will still fail fast (within a second) on a genuine hang.


Note

Low Risk
Test-only timeout tuning with no production or behavioral changes; genuine hangs still fail within one second.

Overview
Raises channel-wait deadlines from time.Millisecond to time.Second in testhelpers/ldtestdata tests that block on mock data-source updates.

Affected helpers include WaitForUpsert, WaitForInit, WaitForNextInit, and AssertChannelClosed in test_data_source_test.go and the shared verifyFlag path in test_data_source_flag_test.go. Assertions and production code are unchanged; only how long tests wait before failing on a missing channel message.

Reviewed by Cursor Bugbot for commit 96abc03. Bugbot is set up for automated code reviews on this repo. Configure here.

test_data_source_test.go and test_data_source_flag_test.go passed a
hardcoded time.Millisecond timeout to WaitForUpsert/WaitForInit/
WaitForNextInit/AssertChannelClosed, which wait on a channel populated
by a producer goroutine. Under -race on slower CI runners (observed on
Windows, Go 1.26), 1ms isn't enough margin and the wait can time out
before the value is delivered even though nothing is wrong. Bump these
to time.Second, which still fails fast on a genuine hang.
@aaron-zeisler aaron-zeisler marked this pull request as ready for review July 13, 2026 23:29
@aaron-zeisler aaron-zeisler requested a review from a team as a code owner July 13, 2026 23:29
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.

1 participant