Skip to content

PowerShell test suite is destructive to a live psmux environment #342

@marhel

Description

@marhel

Problem

Running the ps1 test suite on a machine that has a live psmux kills the user's running sessions and can clobber their config, with no warning. An unsuspecting would-be contributor who runs the tests for the first time without reading them gets an unpleasant surprise.

This is presumably by-design for the throwaway Docker dev container / CI, but nothing in the scripts prevents — or warns about — a destructive run on a normal dev machine.

Evidence

Process killing (kills ALL psmux processes by image name, not just the test's):

  • tests/run_all_tests.ps1 Clean-Server runs Get-Process psmux | Stop-Process -Force before every test (line ~180).
  • Individual tests do it independently, e.g. taskkill /f /im psmux.exe (test_bind_pipe_key.ps1:28, test_bug_detection.ps1:18) and Get-Process psmux | Stop-Process (test_agent_teams_e2e.ps1:127, test_cc_iterm2_compat.ps1:100).

Runtime/config files (operates on the real %USERPROFILE%):

  • run_all_tests.ps1 Clean-Server deletes ~/.psmux\*.port, *.key (lines ~184-185) and ~/.psmux.conf, ~/.psmuxrc (lines ~187-188) unconditionally between tests.
  • Config tests overwrite the real ~/.psmux.conf, e.g. test_bind_key.ps1:284. They attempt to back up and restore it, but the restore is inline (not in a finally), so an error or the runner's 600s Stop-Job timeout between the overwrite and the restore leaves the user's config replaced with test content.

Impact

A contributor who runs the promising-looking tests/run_all_tests.ps1 on their workstation loses their running psmux sessions and risks losing their ~/.psmux.conf.

Ask

Make the suite safe to run on a normal dev machine — at minimum, refuse to run (or otherwise prevent host damage) unless it's clearly in a throwaway environment. Not everyone has the possibility to run Windows containers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions