Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.61 KB

File metadata and controls

26 lines (19 loc) · 1.61 KB

← Back to Backlog

[SC-012] ✅ DONE - Stop-WslDistro: verify termination with retry

Status: Done (2026-03-04) Priority: High Component: tools/pslib/wsl/lib/core.ps1

Summary: As a CI pipeline user, I want Stop-WslDistro to verify the distro is actually terminated before returning, so that subsequent operations like cloning don't fail due to a still-running distro.

Description: The integration test "Should clone Debian to custom distro and print executed commands" in wsl-manager.docker.Integration.Tests.ps1 intermittently fails because Stop-WslDistro returns before the distribution is fully terminated. wsl.exe --terminate is asynchronous — the distro may still be in a "Stopping" state when the function returns, causing Copy-WslDistro (which requires a stopped distro) to fail.

Stop-WslDistro should poll Test-WslDistroRunning after issuing the terminate command, retrying up to 3 times with a short delay between checks, and report success or failure accordingly.

Acceptance Criteria:

  • After wsl.exe --terminate, Stop-WslDistro checks Test-WslDistroRunning to confirm the distro has stopped
  • Retries up to 3 times with a delay (e.g., 1 second) between checks
  • Returns successfully (or writes informational output) when termination is confirmed
  • Throws a terminating error if the distro is still running after all retries
  • Unit tests cover the retry/verification logic (mock Test-WslDistroRunning to simulate delayed stop)
  • The flaky clone test in CI passes reliably
  • All existing tests continue to pass

← Back to Backlog