(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func TestSSHConfigCleanupWithIP(t *testing.T) { |
| 237 | env := testutils.SetupTestEnvironment(t) |
| 238 | defer env.Cleanup() |
| 239 | |
| 240 | originalHome := os.Getenv("HOME") |
| 241 | defer os.Setenv("HOME", originalHome) |
| 242 | os.Setenv("HOME", env.TempDir) |
| 243 | |
| 244 | sshConfigPath := testutils.CreateMockSSHConfig(t, env.TempDir) |
| 245 | |
| 246 | instanceID := "test-instance" |
| 247 | ipAddress := "192.168.1.100" |
| 248 | |
| 249 | err := cleanupSSHConfig(instanceID, ipAddress) |
| 250 | require.NoError(t, err) |
| 251 | |
| 252 | configData, err := os.ReadFile(sshConfigPath) |
| 253 | require.NoError(t, err) |
| 254 | |
| 255 | configContent := string(configData) |
| 256 | assert.NotContains(t, configContent, "tnr-test-instance") |
| 257 | } |
| 258 | |
| 259 | func TestSSHConfigCleanupWithoutIP(t *testing.T) { |
| 260 | env := testutils.SetupTestEnvironment(t) |
nothing calls this directly
no test coverage detected