Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanGitEnv ¶
CleanGitEnv returns a copy of base with git repository-routing env vars removed.
func IsolateTmuxSocket ¶ added in v1.7.3
func IsolateTmuxSocket() func()
IsolateTmuxSocket points TMUX_TMPDIR at a unique temp directory for this test process, so that `tmux new-session`, `tmux list-sessions`, and `tmux kill-session` commands spawned by the test suite all operate on an isolated tmux socket — NOT the user's default `/tmp/tmux-<uid>/default`.
Why this matters:
Before this helper existed, `go test ./...` on a host with active agent-deck sessions (a conductor running, user sessions in flight) caused cascading session death. The test suite creates and kills tmux sessions as part of normal test fixture setup/teardown. Without socket isolation, those operations hit the user's real tmux server:
- New sessions pile up in the user's server, polluting `tmux ls` output for the duration of the test run.
- The cleanup paths in various tests (kill-session patterns, post-TestMain cleanup) can kill or destabilize the user's tmux server, taking down every user session with it.
- Incident on 2026-04-17: a maintainer ran `go test ./...` during PR review; every user session in the personal profile went to error state within 24 minutes as the shared tmux server died.
Call this from every package-level `TestMain` that touches tmux:
func TestMain(m *testing.M) {
cleanup := testutil.IsolateTmuxSocket()
defer cleanup()
os.Exit(m.Run())
}
Returns a cleanup function that removes the temp directory.
func UnsetGitRepoEnv ¶
func UnsetGitRepoEnv()
UnsetGitRepoEnv removes git repository-routing env vars from the current process. This prevents subprocess git commands from accidentally targeting the caller's repo.
Types ¶
This section is empty.