Skip to content

Stabilize SingleWorkerInvocationUnderLoad test - #9919

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:copilot/fix-single-worker-invocation-flake-20260215-142235
Feb 15, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:copilot/fix-single-worker-invocation-flake-20260215-142235

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Feb 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace timing-based delay in SingleWorkerInvocationUnderLoad with deterministic state polling
  • use IManagementGrain.GetGrainActivationCount plus the existing Until helper to wait for a single activation
  • keep scope limited to the flaky test

Testing

  • dotnet test .\test\Tester\Tester.csproj --filter "FullyQualifiedName=UnitTests.General.StatelessWorkerActivationTests.SingleWorkerInvocationUnderLoad" (30 iterations)
  • dotnet test .\test\Tester\Tester.csproj --filter "FullyQualifiedName~UnitTests.General.StatelessWorkerActivationTests" --no-build
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings February 15, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 IManagementGrain to query actual activation counts from the Orleans runtime
  • Added polling logic using the Until helper 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;

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@ReubenBond
ReubenBond enabled auto-merge February 15, 2026 15:13
Replace timing-based delay in SingleWorkerInvocationUnderLoad with state-based polling via IManagementGrain activation count.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond
ReubenBond force-pushed the copilot/fix-single-worker-invocation-flake-20260215-142235 branch from c52ac6f to ceeaabc Compare February 15, 2026 17:01
@ReubenBond
ReubenBond disabled auto-merge February 15, 2026 17:18
@ReubenBond
ReubenBond enabled auto-merge February 15, 2026 20:57
@ReubenBond
ReubenBond disabled auto-merge February 15, 2026 20:57
@ReubenBond
ReubenBond merged commit 29816bf into dotnet:main Feb 15, 2026
59 checks passed
@ReubenBond
ReubenBond deleted the copilot/fix-single-worker-invocation-flake-20260215-142235 branch February 15, 2026 20:57
ReubenBond added a commit that referenced this pull request Feb 15, 2026
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>
rkargMsft pushed a commit to rkargMsft/orleans that referenced this pull request Feb 27, 2026
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>
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants