Fix flaky DeployCommandIncludesDeployFlagInArguments test #12191
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.
Description
This PR fixes the flaky test
Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArgumentswhich was failing consistently on Windows (100% failure rate) and intermittently on Linux (38.7%) and macOS (16.1%).Root Cause
The test mock
TestAppHostBackchannel.GetPublishingActivitiesAsync()was incomplete. The actual CLI code inPublishCommandBase.ProcessAndDisplayPublishingActivitiesAsync()waits for aPublishingActivityTypes.PublishCompleteactivity before callingRequestStopAsync()on the backchannel.The mock implementation was yielding several step and task activities but never yielding the required
PublishCompleteactivity, causing the test to hang until timeout (10 seconds).Changes Made
PublishCompleteactivity to the default implementation ofTestAppHostBackchannel.GetPublishingActivitiesAsync()[QuarantinedTest]attribute from the test since it now passes reliablyTesting
DeployCommandTestsclass continue to passAnalysis from Quarantined Test Results
Based on 93 test runs from the quarantine pipeline:
The platform-specific failure rates suggest timing differences in task scheduling and I/O operations between operating systems.
Fixes #11217