Status: Done (2026-02-22)
Priority: Low
Component: tools/pslib/wsl/wsl-manager.docker.Integration.Tests.ps1
Description:
The "Should handle terminating an already stopped distribution gracefully" integration test was flaky. It asserted the output matched "No running", which is the early-exit message from Invoke-TerminateDistro when zero distros are running. However, when other WSL distros happened to be running on the machine, the code took a different path through Stop-WslDistro, which emits "Distribution '<name>' is not running." — failing the regex match.
Fix: Replaced the brittle message assertion with two robust checks: (1) the operation does not throw, and (2) the distribution remains in Stopped state. This validates the actual contract (graceful no-op) regardless of other running distros.
Acceptance Criteria:
- Test no longer depends on specific warning message text
- Test asserts no exception is thrown (graceful handling)
- Test asserts distribution remains in Stopped state
- Test passes regardless of other running WSL distributions