TestRemoveSSHHostEntryNonExistent verifies that the removeSSHHostEntry function handles non-existent entries gracefully without errors.
(t *testing.T)
| 153 | // TestRemoveSSHHostEntryNonExistent verifies that the removeSSHHostEntry function |
| 154 | // handles non-existent entries gracefully without errors. |
| 155 | func TestRemoveSSHHostEntryNonExistent(t *testing.T) { |
| 156 | env := testutils.SetupTestEnvironment(t) |
| 157 | defer env.Cleanup() |
| 158 | |
| 159 | sshDir := filepath.Join(env.TempDir, ".ssh") |
| 160 | require.NoError(t, os.MkdirAll(sshDir, 0700)) |
| 161 | |
| 162 | sshConfigPath := filepath.Join(sshDir, "config") |
| 163 | sshConfig := `Host tnr-existing |
| 164 | HostName 192.168.1.100 |
| 165 | User ubuntu |
| 166 | ` |
| 167 | require.NoError(t, os.WriteFile(sshConfigPath, []byte(sshConfig), 0600)) |
| 168 | |
| 169 | err := removeSSHHostEntry(sshConfigPath, "nonexistent") |
| 170 | require.NoError(t, err) |
| 171 | |
| 172 | configData, err := os.ReadFile(sshConfigPath) |
| 173 | require.NoError(t, err) |
| 174 | |
| 175 | configContent := string(configData) |
| 176 | assert.Contains(t, configContent, "tnr-existing") |
| 177 | } |
| 178 | |
| 179 | // TestDeleteInstanceResponse verifies that the delete instance response |
| 180 | // structure contains the expected fields and values. |
nothing calls this directly
no test coverage detected