Stabilize SingleWorkerInvocationUnderLoad test - #9919
ReubenBond merged 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR stabilizes a flaky test by replacing timing-based delays with deterministic state polling. The test SingleWorkerInvocationUnderLoad verifies that stateless worker grains maintain a single activation when requests are sequential (no concurrent load). The change improves test reliability by using IManagementGrain.GetGrainActivationCount combined with the Until helper instead of relying on timing assumptions.
Changes:
- Introduced
IManagementGrainto query actual activation counts from the Orleans runtime - Added polling logic using the
Untilhelper to wait for the expected activation count (1) with a 5-second timeout - Preserved the loop structure to verify consistent single-activation behavior across 100 iterations
| { | ||
| var workerGrain = _fixture.GrainFactory.GetGrain<IStatelessWorkerScalingGrain>(0); | ||
| var managementGrain = _fixture.GrainFactory.GetGrain<IManagementGrain>(0); | ||
| var grainReference = (GrainReference)workerGrain; |
There was a problem hiding this comment.
The GrainReference type requires a using Orleans.Runtime; directive at the top of the file. Without it, this code will not compile. Note that the same issue affects existing code at lines 150, 156, and 165 in the CatalogCleanupOnDeactivation test.
Replace timing-based delay in SingleWorkerInvocationUnderLoad with state-based polling via IManagementGrain activation count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c52ac6f to
ceeaabc
Compare
Stabilize stateless worker activation test Replace timing-based delay in SingleWorkerInvocationUnderLoad with state-based polling via IManagementGrain activation count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stabilize stateless worker activation test Replace timing-based delay in SingleWorkerInvocationUnderLoad with state-based polling via IManagementGrain activation count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
SingleWorkerInvocationUnderLoadwith deterministic state pollingIManagementGrain.GetGrainActivationCountplus the existingUntilhelper to wait for a single activationTesting
Microsoft Reviewers: Open in CodeFlow