Fix flaky tests: InboxSpec, ShardRegionSpec, and scheduler interval test#8035
Merged
Aaronontheweb merged 3 commits intoJan 27, 2026
Merged
Conversation
- InboxSpec.Inbox_have_a_default_and_custom_timeouts: Handle both direct TimeoutException and AggregateException-wrapped TimeoutException since Inbox.Receive() uses async internally and may wrap exceptions - ShardRegionSpec.ClusterSharding_must: Convert AwaitRebalance to async using ExpectMsgAsync to avoid synchronous blocking during shard rebalance wait
The ScheduleRepeatedly_in_milliseconds_Tests_and_verify_the_interval test was failing on CI with 13.24% deviation (expected max 10%). CI machines have significant timing variability due to CPU contention, virtualization overhead, and GC pauses. Increased tolerance from 10% to 30% to accommodate CI variability while still catching gross scheduler bugs (e.g., intervals off by 50%+).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes flaky tests discovered in PR #8023 and #8035 CI runs.
Changes
1. InboxSpec.Inbox_have_a_default_and_custom_timeouts
Assert.Throws<TimeoutException>fails becauseInbox.Receive()internally uses async and can wrap the TimeoutException in an AggregateExceptionRecord.Exceptionand check for both direct TimeoutException and AggregateException-wrapped TimeoutException using helper methodIsTimeoutException2. ShardRegionSpec.ClusterSharding_must
ExpectMsg<int>inAwaitRebalancecould timeout during shard rebalancingAwaitRebalanceto asyncAwaitRebalanceAsyncusingExpectMsgAsync<int>, and useAwaitAssertAsyncat the call site3. DefaultScheduler_ActionScheduler_Schedule_Tests.ScheduleRepeatedly_in_milliseconds_Tests_and_verify_the_interval
Test plan