Skip to content

test(network): fix race in TestNotifier_VariousFlows/Happy_flow - #4502

Merged
stevenvegt merged 1 commit into
masterfrom
test/fix-flaky-notifier-happy-flow
Sep 9, 2026
Merged

test(network): fix race in TestNotifier_VariousFlows/Happy_flow#4502
stevenvegt merged 1 commit into
masterfrom
test/fix-flaky-notifier-happy-flow

Conversation

@stevenvegt

Copy link
Copy Markdown
Member

Fixes the flaky TestNotifier_VariousFlows/Happy_flow seen on #4487.

The subtest waited until the receiver callback had run twice and then read the persisted event, expecting two retries. notifyNow increments and writes the retry count only after the callback returns, and the next retry follows within tens of milliseconds, so on a loaded runner the read could land between the second callback and its write and observe one retry (expected 2, actual 1). It is the same race that #4274 fixed for TestNotifier_Notify; the other subtests in this function already wait on the persisted retry count.

The subtest now waits for the persisted retry count to reach 2 and checks that the callback ran at least that often. Verified with go test -race -count=30 on the package.

Backports to V6.2 and V5.4 follow, both branches have the same subtest.

The subtest waited until the receiver callback had run twice and then
read the persisted event, expecting two retries. notifyNow increments
and writes the retry count only after the callback returns, so on a
loaded runner the read could land between the second callback and its
write and observe one retry. Same race as fixed for TestNotifier_Notify
in #4274; observed on #4487.

The subtest now waits for the persisted retry count and checks that
the callback ran at least that often.

Assisted-by: AI
@stevenvegt
stevenvegt merged commit 94ee911 into master Sep 9, 2026
12 checks passed
@stevenvegt
stevenvegt deleted the test/fix-flaky-notifier-happy-flow branch September 9, 2026 13:00
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