Skip to content

tailcat: make interactive SSH tests hermetic and add netns idempotency regression test - #6

Merged
awdemos merged 1 commit into
mainfrom
fix-pty-hang-proper
Aug 30, 2026
Merged

tailcat: make interactive SSH tests hermetic and add netns idempotency regression test#6
awdemos merged 1 commit into
mainfrom
fix-pty-hang-proper

Conversation

@awdemos

@awdemos awdemos commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

This PR finishes the work PR tailscale#8 started on the SSH PTY lifecycle and adds a regression test for the netns.SetEnabled(false) idempotency fix.

Changes

  1. tailcat_ssh.go: The embedded SSH server now honors the process HOME environment variable when configuring the session shell. This allows callers (and tests) to override the home directory used for the SSH session without changing /etc/passwd.

  2. tailcat_ssh_test.go: setupSSHEnv now sets a clean, temporary HOME directory before starting the server, and restores the original HOME in t.Cleanup. This makes the SSH tests hermetic so the login shell started in the PTY doesn't source the real user's dotfiles (e.g. a .bashrc that auto-attaches tmux and ignores exit). The t.Skip on TestSSHSuite/InteractiveShell is removed.

  3. tailcat_test.go: Adds TestNetNSDisabledOnce, a regression test that creates two sequential Server/Client pairs in the same process. This exercises the sync.Once wrapping netns.SetEnabled(false) so that the second engine creation does not panic.

Verification

  • go test -run 'TestSSHSuite|TestNetNSDisabledOnce' . passes.
  • go test ./... passes.

…y regression test

PR tailscale#8 fixed most of the PTY lifecycle, but TestSSHSuite/InteractiveShell
still hung on this machine because the login shell sourced .bashrc, which
auto-attaches tmux and never exits on 'exit'. Fix the embedded SSH server
to honor the process HOME environment variable, and run the SSH test server
with a clean temporary HOME so the test is hermetic.

Also add TestNetNSDisabledOnce, a regression test for the fix that wraps
netns.SetEnabled(false) in a sync.Once so multiple Server/Client lifetimes
in the same process don't panic.
@awdemos
awdemos merged commit d902d6f into main Aug 30, 2026
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.

1 participant