-
Notifications
You must be signed in to change notification settings - Fork 770
Fix flaky ExecuteCommandAsync tests by removing DCP dependency #12806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12806Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12806" |
Make ExecuteCommandAsync_HasReplicas_Canceled_CalledPerReplica and ExecuteCommandAsync_HasReplicas_MixedFailureAndCanceled_OnlyFailuresInErrorMessage more robust by: - Using AddResource(new CustomResource(...)) with DcpInstancesAnnotation instead of AddProject - Removing WaitForResourceHealthyAsync which depends on DCP connection - Following the pattern from ExecuteCommandAsync_ResourceNameMultipleMatches_Success This eliminates the dependency on DCP infrastructure starting correctly, making the tests more stable and faster. Co-authored-by: radical <[email protected]>
0464828 to
225b12b
Compare
|
@radical Good to merge? |
There was a problem hiding this comment.
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 fixes a flaky test (ExecuteCommandAsync_HasReplicas_Canceled_CalledPerReplica) that was timing out due to DCP infrastructure dependency. The fix refactors four test methods to use CustomResource with DcpInstancesAnnotation instead of AddProject<Projects.ServiceA>().WithReplicas(), eliminating the need to wait for DCP connection and resource health checks. This reduces execution time from 30+ seconds with frequent 180s timeouts to consistent 10-11 seconds.
Key Changes
- Replaced DCP-dependent project resources with
CustomResourceand manualDcpInstancesAnnotationconfiguration - Removed
WaitForResourceHealthyAsync()calls that were causing timeout failures - Removed unused
using Aspire.TestUtilities;import - Removed QuarantinedTest attributes from two previously flaky tests
- Designer.cs file has auto-generated alphabetical reordering (no functional changes)
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/ResourceCommandServiceTests.cs | Refactored 4 test methods to eliminate DCP dependency by using CustomResource with DcpInstancesAnnotation instead of AddProject with WithReplicas; removed QuarantinedTest attributes; added explicit assertions for resolved resource names |
| src/Aspire.Cli/Resources/McpCommandStrings.Designer.cs | Auto-generated alphabetical reordering of properties (no functional changes) |
Files not reviewed (1)
- src/Aspire.Cli/Resources/McpCommandStrings.Designer.cs: Language not supported
| } | ||
|
|
||
| [Fact] | ||
| [QuarantinedTest("https://github.com/dotnet/aspire/issues/9832")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Add this back. This will be removed once the test is consistently passing on the quarantined-tests workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
|
|
||
| [Fact] | ||
| [QuarantinedTest("https://github.com/dotnet/aspire/issues/9834")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot and add back this one too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already added in c8ad23b - the [QuarantinedTest("https://github.com/dotnet/aspire/issues/9834")] attribute is now on line 155 for ExecuteCommandAsync_HasReplicas_Failure_CalledPerReplica.
Add back QuarantinedTest attributes to ExecuteCommandAsync_HasReplicas_Success_CalledPerReplica and ExecuteCommandAsync_HasReplicas_Failure_CalledPerReplica. These tests need to prove they're consistently passing in the quarantined-tests workflow before the attribute can be permanently removed. Also restored the missing 'using Aspire.TestUtilities;' import. Co-authored-by: radical <[email protected]>
Description
Refactored
ExecuteCommandAsync_HasReplicas_Canceled_CalledPerReplicaandExecuteCommandAsync_HasReplicas_MixedFailureAndCanceled_OnlyFailuresInErrorMessageto eliminate DCP infrastructure dependency:AddProject<Projects.ServiceA>withAddResource(new CustomResource(...))DcpInstancesAnnotationto simulate replicasWaitForResourceHealthyAsync()call that depended on DCP startupPattern matches existing
ExecuteCommandAsync_ResourceNameMultipleMatches_Successtest. Tests same command execution logic with multiple replicas without requiring orchestrator infrastructure. Execution time reduced from 30+ seconds (with frequent 180s timeouts) to consistent 10-11 seconds.Also refactored
ExecuteCommandAsync_HasReplicas_Success_CalledPerReplicaandExecuteCommandAsync_HasReplicas_Failure_CalledPerReplicausing the same pattern. These two tests retain their[QuarantinedTest]attributes and will remain quarantined until they prove consistent stability in the quarantined-tests workflow.Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplateOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.