diff --git a/pkg/cmd/codespace/ssh.go b/pkg/cmd/codespace/ssh.go index 9c7ee9e8d..a398962dd 100644 --- a/pkg/cmd/codespace/ssh.go +++ b/pkg/cmd/codespace/ssh.go @@ -286,7 +286,7 @@ func selectSSHKeys( } // Finally, fall back to generating new automatic keys - autoKeyPair, err := setupAutomaticSSHKeys(sshContext) + autoKeyPair, err := generateAutomaticSSHKeys(sshContext) if err != nil { return nil, false, fmt.Errorf("generating automatic keypair: %v", err) } @@ -320,7 +320,7 @@ func automaticSSHKeyPair(sshContext ssh.Context) *ssh.KeyPair { return nil } -func setupAutomaticSSHKeys(sshContext ssh.Context) (*ssh.KeyPair, error) { +func generateAutomaticSSHKeys(sshContext ssh.Context) (*ssh.KeyPair, error) { keyPair := checkAndUpdateOldKeyPair(sshContext) if keyPair != nil { return keyPair, nil diff --git a/pkg/cmd/codespace/ssh_test.go b/pkg/cmd/codespace/ssh_test.go index 9f276e7d7..fdbca1974 100644 --- a/pkg/cmd/codespace/ssh_test.go +++ b/pkg/cmd/codespace/ssh_test.go @@ -26,11 +26,11 @@ func TestPendingOperationDisallowsSSH(t *testing.T) { } } -func TestAutomaticSSHKeyPairs(t *testing.T) { +func TestGenerateAutomaticSSHKeys(t *testing.T) { tests := []struct { - // These files exist when calling setupAutomaticSSHKeys + // These files exist when calling generateAutomaticSSHKeys existingFiles []string - // These files should exist after setupAutomaticSSHKeys finishes + // These files should exist after generateAutomaticSSHKeys finishes wantFinalFiles []string }{ // Basic case: no existing keys, they should be created @@ -81,12 +81,12 @@ func TestAutomaticSSHKeyPairs(t *testing.T) { f.Close() } - keyPair, err := setupAutomaticSSHKeys(sshContext) + keyPair, err := generateAutomaticSSHKeys(sshContext) if err != nil { - t.Errorf("Unexpected error from setupAutomaticSSHKeys: %v", err) + t.Errorf("Unexpected error from generateAutomaticSSHKeys: %v", err) } if keyPair == nil { - t.Fatal("Unexpected nil KeyPair from setupAutomaticSSHKeys") + t.Fatal("Unexpected nil KeyPair from generateAutomaticSSHKeys") } if !strings.HasSuffix(keyPair.PrivateKeyPath, automaticPrivateKeyName) { t.Errorf("Expected private key path %v, got %v", automaticPrivateKeyName, keyPair.PrivateKeyPath) @@ -98,7 +98,7 @@ func TestAutomaticSSHKeyPairs(t *testing.T) { // Check that all the expected files are present for _, file := range tt.wantFinalFiles { if _, err := os.Stat(filepath.Join(dir, file)); err != nil { - t.Errorf("Want file %q to exist after setupAutomaticSSHKeys but it doesn't", file) + t.Errorf("Want file %q to exist after generateAutomaticSSHKeys but it doesn't", file) } } @@ -118,7 +118,7 @@ func TestAutomaticSSHKeyPairs(t *testing.T) { } if !isWantedFile { - t.Errorf("Unexpected file %q exists after setupAutomaticSSHKeys", filename) + t.Errorf("Unexpected file %q exists after generateAutomaticSSHKeys", filename) } } }