From 686a34552673400b0fd84cd460cd244555e182f4 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Thu, 29 Aug 2024 15:48:43 -0700 Subject: [PATCH] e2e: replace '%s' with %q %q handles quotes inside the quoted strings better. --- testing/internal/e2e/helpers.go | 4 ++-- testing/internal/e2e/tests/base/auth_token_delete_test.go | 2 +- testing/internal/e2e/tests/base/credential_store_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/internal/e2e/helpers.go b/testing/internal/e2e/helpers.go index 964f7699e1..837e389767 100644 --- a/testing/internal/e2e/helpers.go +++ b/testing/internal/e2e/helpers.go @@ -133,7 +133,7 @@ func WithEnv(name string, value string) Option { func MaybeSkipTest(t testing.TB) { if _, ok := os.LookupEnv(EnvToCheckSkip); !ok { t.Skipf( - "Skipping test because environment variable '%s' is not set. This is needed for e2e tests.", + "Skipping test because environment variable %q is not set. This is needed for e2e tests.", EnvToCheckSkip, ) } @@ -144,7 +144,7 @@ func MaybeSkipSlowTest(t testing.TB) { MaybeSkipTest(t) if _, ok := os.LookupEnv(EnvToCheckSlowSkip); !ok { t.Skipf( - "Skipping test because environment variable '%s' is not set. This is needed for slow e2e tests.", + "Skipping test because environment variable %q is not set. This is needed for slow e2e tests.", EnvToCheckSlowSkip, ) } diff --git a/testing/internal/e2e/tests/base/auth_token_delete_test.go b/testing/internal/e2e/tests/base/auth_token_delete_test.go index 34a4f5767b..feb37f7e43 100644 --- a/testing/internal/e2e/tests/base/auth_token_delete_test.go +++ b/testing/internal/e2e/tests/base/auth_token_delete_test.go @@ -85,6 +85,6 @@ func TestUserIsLoggedOutWhenAuthTokenIsDeletedCli(t *testing.T) { ) // Expect error as the user got logged out - require.Error(t, output.Err, fmt.Sprintf("User '%s' is still logged in", testAccountName)) + require.Error(t, output.Err, fmt.Sprintf("User %q is still logged in", testAccountName)) t.Log("Successfully verified that token name is invalid") } diff --git a/testing/internal/e2e/tests/base/credential_store_test.go b/testing/internal/e2e/tests/base/credential_store_test.go index fc33b51c27..6b6c44af34 100644 --- a/testing/internal/e2e/tests/base/credential_store_test.go +++ b/testing/internal/e2e/tests/base/credential_store_test.go @@ -142,7 +142,7 @@ func TestCliStaticCredentialStore(t *testing.T) { e2e.WithArgs("credential-stores", "read", "-id", storeId, "-format", "json"), ) if output.Err == nil { - return fmt.Errorf("Deleted credential can still be read: '%s'", output.Stdout) + return fmt.Errorf("Deleted credential can still be read: %q", output.Stdout) } var response boundary.CliError