This commit is contained in:
Viktor Liu
2025-07-02 20:10:59 +02:00
parent 279b77dee0
commit 4bbca28eb6
19 changed files with 71 additions and 417 deletions

View File

@@ -207,9 +207,7 @@ func TestManager_DirectoryFallback(t *testing.T) {
defer os.RemoveAll(tempDir)
// Set HOME to temp directory to control user fallback
originalHome := os.Getenv("HOME")
os.Setenv("HOME", tempDir)
defer os.Setenv("HOME", originalHome)
t.Setenv("HOME", tempDir)
// Create manager with non-writable system directories
manager := &Manager{
@@ -306,15 +304,7 @@ func TestManager_PeerLimit(t *testing.T) {
func TestManager_ForcedSSHConfig(t *testing.T) {
// Set force environment variable
originalForce := os.Getenv(EnvForceSSHConfig)
os.Setenv(EnvForceSSHConfig, "true")
defer func() {
if originalForce == "" {
os.Unsetenv(EnvForceSSHConfig)
} else {
os.Setenv(EnvForceSSHConfig, originalForce)
}
}()
t.Setenv(EnvForceSSHConfig, "true")
// Create temporary directory for test
tempDir, err := os.MkdirTemp("", "netbird-ssh-config-test")