Skip to content

fix: use AwaitAssert for eventually-consistent cluster state in QuickRestartSpec#8183

Merged
Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/quick-restart-spec-await-assert
Apr 24, 2026
Merged

fix: use AwaitAssert for eventually-consistent cluster state in QuickRestartSpec#8183
Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/quick-restart-spec-await-assert

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Member

Summary

  • Wrapped bare cluster state assertions in QuickRestartSpec.JoinAndRestart() with Within(20s, AwaitAssert(...)) to properly poll for gossip convergence
  • The same spec already uses this pattern 15 lines earlier for identical checks — this was simply missing from the post-sleep assertions

Root Cause

After a random 0–14s sleep between rounds, the test asserted Unreachable.Count.ShouldBe(0) without polling. Cluster state is eventually consistent — gossip may not have fully propagated after the sleep, leaving stale Unreachable entries. This caused intermittent failures on CI (observed in build #126246, PR #8181).

Test plan

  • Multi-node cluster tests pass in CI (cannot run locally)
  • No changes to production code — test-only fix

…RestartSpec

The bare assertions at lines 128-130 checked cluster membership and
unreachable state without polling for convergence. After a random sleep
(0-14s), gossip may not have fully propagated, leaving stale Unreachable
entries. The identical checks 15 lines earlier already used
Within(20s, AwaitAssert(...)) — this brings the post-sleep assertions
in line with that pattern.

Cluster state is eventually consistent by design; bare assertions on it
are a test bug, not a framework issue.
…Delay

- All methods now return Task and use WithinAsync/AwaitAssertAsync/RunOnAsync
- Thread.Sleep replaced with await Task.Delay for the gating delay
- Terminate().Wait() replaced with await Terminate().WaitAsync()
- Removed unused System.Threading using
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) April 24, 2026 14:58
@Aaronontheweb Aaronontheweb merged commit aadb88b into akkadotnet:dev Apr 24, 2026
12 checks passed
Aaronontheweb added a commit that referenced this pull request Apr 24, 2026
…RestartSpec (#8183)

* fix: use AwaitAssert for eventually-consistent cluster state in QuickRestartSpec

The bare assertions at lines 128-130 checked cluster membership and
unreachable state without polling for convergence. After a random sleep
(0-14s), gossip may not have fully propagated, leaving stale Unreachable
entries. The identical checks 15 lines earlier already used
Within(20s, AwaitAssert(...)) — this brings the post-sleep assertions
in line with that pattern.

Cluster state is eventually consistent by design; bare assertions on it
are a test bug, not a framework issue.

* Convert QuickRestartSpec to async and replace Thread.Sleep with Task.Delay

- All methods now return Task and use WithinAsync/AwaitAssertAsync/RunOnAsync
- Thread.Sleep replaced with await Task.Delay for the gating delay
- Terminate().Wait() replaced with await Terminate().WaitAsync()
- Removed unused System.Threading using
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant