Skip to content

De-flake RollingUpdateShardAllocationSpec - #8370

Merged
Aaronontheweb merged 2 commits into
akkadotnet:devfrom
Aaronontheweb:fix/rolling-update-shard-spec-flake
Jul 12, 2026
Merged

Aaronontheweb merged 2 commits into
akkadotnet:devfrom
Aaronontheweb:fix/rolling-update-shard-spec-flake

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Member

Fixes the Windows MNTR flake seen on #8368's validation run (unrelated to that PR's Artery-only diff).

The spec's no-duration AwaitAssert { Tell; ExpectMsg } sites inherit a 5-second window with a 5-second inner expect — outer equals inner, so every site is effectively one attempt on the shared TestActor mailbox, and a late reply from a timed-out attempt pollutes the next read. A region whose coordinator is mid-handoff also replies to GetCurrentRegions instantly with an empty set, which is the "expected 3, found 0" failure. The UpMembers check raced simultaneous join+leave gossip convergence in a bare 5 seconds.

Same fix pattern as #8363, applied to all seven sites: fresh probe per attempt, bounded 3-second inner expect, explicit 1-second interval, 30-second windows; spec asyncified to the async TestKit APIs. No assertions weakened. Passes 3/3 locally (~19s per run).

Side-find filed separately as #8369 (the spec's config block nests two settings into dead keys) — deliberately not bundled here.

The spec's no-duration AwaitAssert{Tell;ExpectMsg} sites shared a 5s outer window with a 5s inner ExpectMsg timeout, so each site got only one attempt on the shared TestActor mailbox, and late replies from timed-out attempts could pollute the next read. The fix asyncifies the spec and gives every such site a fresh TestProbe per attempt, a bounded inner expect, and an explicit retry interval, following the pattern already used in ClusterShardingRolePartitioningSpec.
var probe = CreateTestProbe();
shardRegion.Value.Tell(GetCurrentRegions.Instance, probe.Ref);
(await probe.ExpectMsgAsync<CurrentRegions>(TimeSpan.FromSeconds(3))).Regions.Should().HaveCount(3);
}, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

primary fix - gives the internal loop more changes to re-query the ShardRegion. This was busted before to some extent.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) July 12, 2026 13:39
@Aaronontheweb
Aaronontheweb merged commit 9d09209 into akkadotnet:dev Jul 12, 2026
11 checks passed
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