|
|
@@ -1075,16 +1075,12 @@ func TestUpdatePrefs(t *testing.T) {
|
|
|
for _, tt := range tests {
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
if tt.sshOverTailscale {
|
|
|
- old := getSSHClientEnvVar
|
|
|
- getSSHClientEnvVar = func() string { return "100.100.100.100 1 1" }
|
|
|
- t.Cleanup(func() { getSSHClientEnvVar = old })
|
|
|
+ tstest.Replace(t, &getSSHClientEnvVar, func() string { return "100.100.100.100 1 1" })
|
|
|
} else if isSSHOverTailscale() {
|
|
|
// The test is being executed over a "real" tailscale SSH
|
|
|
// session, but sshOverTailscale is unset. Make the test appear
|
|
|
// as if it's not over tailscale SSH.
|
|
|
- old := getSSHClientEnvVar
|
|
|
- getSSHClientEnvVar = func() string { return "" }
|
|
|
- t.Cleanup(func() { getSSHClientEnvVar = old })
|
|
|
+ tstest.Replace(t, &getSSHClientEnvVar, func() string { return "" })
|
|
|
}
|
|
|
if tt.env.goos == "" {
|
|
|
tt.env.goos = "linux"
|