MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / TestSSHConfigCleanupWithoutIP

Function TestSSHConfigCleanupWithoutIP

cmd/delete_test.go:259–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

257}
258
259func 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")

Callers

nothing calls this directly

Calls 4

SetupTestEnvironmentFunction · 0.92
CreateMockSSHConfigFunction · 0.92
cleanupSSHConfigFunction · 0.85
ReadFileMethod · 0.65

Tested by

no test coverage detected