From c5b07762d16e6a85df80a323518931f155253132 Mon Sep 17 00:00:00 2001 From: Caleb Brose <5447118+cmbrose@users.noreply.github.com> Date: Wed, 29 Jun 2022 10:51:17 -0500 Subject: [PATCH] Check the key paths too --- pkg/cmd/codespace/ssh_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/cmd/codespace/ssh_test.go b/pkg/cmd/codespace/ssh_test.go index 753772c7d..2939739d7 100644 --- a/pkg/cmd/codespace/ssh_test.go +++ b/pkg/cmd/codespace/ssh_test.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" "testing" "github.com/cli/cli/v2/internal/codespaces/api" @@ -87,6 +88,12 @@ func TestAutomaticSSHKeyPairs(t *testing.T) { if keyPair == nil { t.Error("Unexpected nil KeyPair from setupAutomaticSSHKeys") } + if !strings.HasSuffix(keyPair.PrivateKeyPath, automaticPrivateKeyName) { + t.Errorf("Expected private key path %v, got %v", automaticPrivateKeyName, keyPair.PrivateKeyPath) + } + if !strings.HasSuffix(keyPair.PublicKeyPath, automaticPrivateKeyName+".pub") { + t.Errorf("Expected public key path %v, got %v", automaticPrivateKeyName+".pub", keyPair.PublicKeyPath) + } // Check that all the expected files are present for _, file := range tt.wantFinalFiles {