Skip to content

test(devshard): de-flake TestGRPCProvider_ServerNotSyncedPausesBetweenPolls#1411

Closed
ouicate wants to merge 1 commit into
gonka-ai:mainfrom
ouicate:test/deflake-grpc-provider-not-synced
Closed

test(devshard): de-flake TestGRPCProvider_ServerNotSyncedPausesBetweenPolls#1411
ouicate wants to merge 1 commit into
gonka-ai:mainfrom
ouicate:test/deflake-grpc-provider-not-synced

Conversation

@ouicate

@ouicate ouicate commented Jul 6, 2026

Copy link
Copy Markdown

Problem

TestGRPCProvider_ServerNotSyncedPausesBetweenPolls slept a fixed 30ms after
New() and then asserted that exactly one call had been made. But New() starts
the long-poll loop asynchronously (go newGRPCRunner(...).run(...)), so on a
loaded 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 to
the 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.Eventually waits:

  • wait for the initial fetch (tolerant of async goroutine startup), then assert
    exactly one call so far — the next poll is one ErrorBackoffMin (50ms) away, so
    a single call still proves the loop is pacing itself, not busy-looping;
  • wait for the second poll after the backoff, then bound the call count across a
    short window to preserve the original "paced, not a busy loop" guarantee.

No production code changes.

Tests

go test ./runtimeconfig/ -run TestGRPCProvider_ServerNotSyncedPausesBetweenPolls -count=100
and -count=60 -cpu=1 are both green; go vet and gofmt are clean.

…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.
@ouicate ouicate closed this Jul 6, 2026
@ouicate
ouicate deleted the test/deflake-grpc-provider-not-synced branch July 6, 2026 13:13
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