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

Function TestSSHConfigCleanupWithIP

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

Source from the content-addressed store, hash-verified

234}
235
236func 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
259func TestSSHConfigCleanupWithoutIP(t *testing.T) {
260 env := testutils.SetupTestEnvironment(t)

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