Skip to content

test(admin): fix stale-claim networking test flake - #9394

Open
eventualbuddha wants to merge 1 commit into
mainfrom
misc/admin-networking-stale-claim-flake
Open

eventualbuddha wants to merge 1 commit into
mainfrom
misc/admin-networking-stale-claim-flake

Conversation

@eventualbuddha

Copy link
Copy Markdown
Contributor

Overview

The waitFor for the client's disconnect could sometimes advance fake time past STALE_MACHINE_THRESHOLD_MS on a loaded machine. This made it release the claim before the test asserted it survived a short disconnect. Do the assert after a shorter fixed time advance instead.

Demo Video or Screenshot

From the failing job:

 FAIL  src/app_networking.test.ts > a ballot claimed via the peer API is released when the client goes stale
AssertionError: expected 'e636583f-0b7a-4a5b-bee1-be8e49dff226' to be undefined

- Expected:
undefined

+ Received:
"e636583f-0b7a-4a5b-bee1-be8e49dff226"

 ❯ src/app_networking.test.ts:465:63
    463|
    464|   // The claim survives a disconnect shorter than the stale threshold
    465|   expect(claimNextOnHost(store, electionId, 'OTHER-MACHINE')).toBeUnde…
       |                                                               ^
    466|
    467|   // Once the client is stale, the host's polling loop releases the cl…

Testing Plan

Ran locally with an artificially-inflated fake time advance and saw it reproduce consistently.

The `waitFor` for the client's disconnect could sometimes advance fake time past `STALE_MACHINE_THRESHOLD_MS` on a loaded machine. This made it release the claim before the test asserted it survived a short disconnect. Do the assert after a shorter fixed time advance instead.
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