test(devshard): de-flake TestGRPCProvider_ServerNotSyncedPausesBetweenPolls#1411
Closed
ouicate wants to merge 1 commit into
Closed
test(devshard): de-flake TestGRPCProvider_ServerNotSyncedPausesBetweenPolls#1411ouicate wants to merge 1 commit into
ouicate wants to merge 1 commit into
Conversation
…nPolls New() starts the runtime-config long-poll loop asynchronously, so the initial fetch may not have landed within the fixed 30ms the test slept before asserting exactly one call. On a loaded CI runner the goroutine's first gRPC call had not happened yet, producing an "expected 1, got 0" failure. Wait for the initial fetch (and the second, post-backoff poll) via require.Eventually instead of assuming fixed delays, and keep the anti-busy-loop assertion by bounding the call count across a window. Verified stable across 100 runs (and 60 with -cpu=1). No production code changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestGRPCProvider_ServerNotSyncedPausesBetweenPollsslept a fixed 30ms afterNew()and then asserted that exactly one call had been made. ButNew()startsthe long-poll loop asynchronously (
go newGRPCRunner(...).run(...)), so on aloaded runner the goroutine's first gRPC call may not have landed within 30ms —
the test then fails with
expected 1, got 0. This is a timing flake unrelated tothe code under test (it surfaced on an unrelated PR's CI: the "Build and Test
Devshard" job for #1410).
Fix
Replace the fixed-delay assumptions with
require.Eventuallywaits:exactly one call so far — the next poll is one
ErrorBackoffMin(50ms) away, soa single call still proves the loop is pacing itself, not busy-looping;
short window to preserve the original "paced, not a busy loop" guarantee.
No production code changes.
Tests
go test ./runtimeconfig/ -run TestGRPCProvider_ServerNotSyncedPausesBetweenPolls -count=100and
-count=60 -cpu=1are both green;go vetandgofmtare clean.