Tests: don't assume endpoint discovery is synchronous with connect (#3197)
* Tests: don't assume endpoint discovery is synchronous with connect EndpointPruningUnitTests.NodeAbsentFromTopologyIsPrunedAfterThreeGenerations fails on CI roughly one run in four, at the Assert.Contains *before* any pruning is involved - so the test never reached the behaviour it exists to check. A node learned from the CLUSTER SLOTS reply during handshake is registered on the connection's own path, and that does not have to have finished by the time ConnectAsync returns; GetEndPoints() is a snapshot. The invariant these tests care about is that a discovered node appears *promptly*, not synchronously, so they now poll for it. Reproducing this locally needs the CPU constraint, not load: `taskset -c 0,1` plus `-c Release /p:CI=true` reproduces it at about the CI rate, while no amount of parallel load on 14 cores ever did. Verified on main both ways - failing 1-in-4 before, 0-in-6 after. Swept the sibling suites for the same assumption. Most assertions on GetEndPoints() are about *configured* endpoints (present from the start) or follow awaited topology work, so only the two that assert on discovery needed changing: the one above, and NewNodeIsDialledByTheAdvertisedForm. * Honour the ambient test cancellation token while polling Poll.UntilAsync had its own 5s timeout and ignored the framework's, so a cancelled or timed-out test would keep polling to its own schedule, and a predicate that never comes true reported false on our clock rather than surfacing the framework's cancellation. The token goes to Task.Delay rather than being probed between polls, so cancellation lands inside the current interval instead of after it. The local timeout stays as a backstop for any caller with no ambient limit.
M
Marc Gravell committed
6b2324ab34a59f6a96db40e7d4a96370ea6bac9b
Parent: 8b31020
Committed by GitHub <noreply@github.com>
on 8/25/2026, 3:06:52 PM