Skip to content

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Apr 17, 2025

This PR introduces test coverage for the aspire run command. Here is a summary of the changes:

  1. Introduces the IAppHostBackchannel interface so we can mock out backchannel behavior. There is a reusable test implementation of this that should allow us to simulate any behaviors we want.
  2. Changed ConnectAsync(...) so it no longer takes a process, it wasn't using it.
  3. Injects IAnsiConsole as a dependency to RunCommand. This is temporary as eventually the direct usage that RunCommand has on the ansi console will move into IInteractonService but I didn't want to tackle that in this PR. This was necessary to avoid some threading issues in the unit tests (seen that issue before in other areas with Spectre Console).
  4. Added an explicit catch for OperationCancelledException. We were incorrectly returning error code 1 when the user did CTRL-C (writing the tests picked this up).
  5. Relocated some of the existing test services since they are used in multiple places.
  6. Copilot added some negative test cases for simple arg validation scenarios.
  7. Added a end to end success test (which is fully mocked out so it should run quick).

@mitchdenny mitchdenny changed the title Mitchdenny/aspire run unit testing aspire run test coverage Apr 17, 2025
@mitchdenny mitchdenny requested a review from davidfowl April 17, 2025 02:48
@mitchdenny mitchdenny self-assigned this Apr 17, 2025
@mitchdenny mitchdenny added this to the 9.3 milestone Apr 17, 2025
@mitchdenny mitchdenny marked this pull request as ready for review April 17, 2025 02:48
@mitchdenny mitchdenny merged commit 09bcfce into main Apr 17, 2025
175 checks passed
@mitchdenny mitchdenny deleted the mitchdenny/aspire-run-unit-testing branch April 17, 2025 05:25
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants