tailscale/ssh/tailssh
Nick Khyl b70c0c50fd ssh/tailssh: fix data race during execution of test
In tailssh.go:1284, (*sshSession).startNewRecording starts a fire-and-forget goroutine that can
outlive the test that triggered its creation. Among other things, it uses ss.logf, and may call it
after the test has already returned. Since we typically use (*testing.T).Logf as the logger,
this results in a data race and causes flaky tests.

Ideally, we should fix the root cause and/or use a goroutines.Tracker to wait for the goroutine
to complete. But with the release approaching, it's too risky to make such changes now.

As a workaround, we update the tests to use tstest.WhileTestRunningLogger, which logs to t.Logf
while the test is running and disables logging once the test finishes, avoiding the race.

While there, we also fix TestSSHAuthFlow not to use log.Printf.

Updates #15568
Updates #7707 (probably related)

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-10 10:44:11 -05:00
..
testcontainers ssh/tailssh: accept passwords and public keys 2025-02-13 11:29:45 -06:00
accept_env_test.go ssh: Add logic to set accepted environment variables in SSH session (#13559) 2024-09-30 21:47:45 -06:00
accept_env.go ssh: Add logic to set accepted environment variables in SSH session (#13559) 2024-09-30 21:47:45 -06:00
incubator_linux.go ssh/tailssh: fall back to using su when no TTY available on Linux 2024-05-29 13:15:17 -05:00
incubator_plan9.go ssh/tailssh: add Plan 9 support for Tailscale SSH 2025-04-02 07:36:04 -07:00
incubator.go ssh/tailssh: chdir to user's homedir when directly running a command (#15351) 2025-05-09 12:55:57 -07:00
privs_test.go ssh/tailssh: only chdir incubator process to user's homedir when necessary and possible 2024-08-21 13:20:12 -05:00
tailssh_integration_test.go ssh/tailssh: accept passwords and public keys 2025-02-13 11:29:45 -06:00
tailssh_test.go ssh/tailssh: fix data race during execution of test 2025-05-10 10:44:11 -05:00
tailssh.go ssh/tailssh: add Plan 9 support for Tailscale SSH 2025-04-02 07:36:04 -07:00
user.go ssh/tailssh: add Plan 9 support for Tailscale SSH 2025-04-02 07:36:04 -07:00