(t *testing.T)
| 257 | } |
| 258 | |
| 259 | func TestSSHConfigCleanupWithoutIP(t *testing.T) { |
| 260 | env := testutils.SetupTestEnvironment(t) |
| 261 | defer env.Cleanup() |
| 262 | |
| 263 | originalHome := os.Getenv("HOME") |
| 264 | defer os.Setenv("HOME", originalHome) |
| 265 | os.Setenv("HOME", env.TempDir) |
| 266 | |
| 267 | sshConfigPath := testutils.CreateMockSSHConfig(t, env.TempDir) |
| 268 | |
| 269 | instanceID := "test-instance" |
| 270 | ipAddress := "" |
| 271 | |
| 272 | err := cleanupSSHConfig(instanceID, ipAddress) |
| 273 | require.NoError(t, err) |
| 274 | |
| 275 | configData, err := os.ReadFile(sshConfigPath) |
| 276 | require.NoError(t, err) |
| 277 | |
| 278 | configContent := string(configData) |
| 279 | assert.NotContains(t, configContent, "tnr-test-instance") |
| 280 | } |
| 281 | |
| 282 | // func TestSSHConfigCleanupHomeDirError(t *testing.T) { |
| 283 | // t.Skip("Skipping home directory error test - difficult to mock os.UserHomeDir") |
nothing calls this directly
no test coverage detected