From 66569f71a0f29e2499eb3be2628f9b5ae48e625b Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Tue, 9 Apr 2024 10:43:31 +0200 Subject: [PATCH] fix(BRIDGE-7): add timestamp to test credentials for keychain on macOS. --- pkg/keychain/keychain.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pkg/keychain/keychain.go b/pkg/keychain/keychain.go index 0cf62506..95a53efd 100644 --- a/pkg/keychain/keychain.go +++ b/pkg/keychain/keychain.go @@ -220,14 +220,6 @@ func isUsable(helper credentials.Helper, err error) bool { creds := getTestCredentials() - // If the test entry is already present from an interrupted previous test, we must wipe it first. - if _, _, err := helper.Get(creds.ServerURL); err == nil { - if err := helper.Delete(creds.ServerURL); err != nil { - l.WithError(err).Warn("Failed to delete existing test credentials from keychain") - return false - } - } - if err := retry(func() error { return helper.Add(creds) }); err != nil { @@ -252,7 +244,7 @@ func getTestCredentials() *credentials.Credentials { // On macOS, a handful of users experience failures of the test credentials. if runtime.GOOS == "darwin" { return &credentials.Credentials{ - ServerURL: hostURL(constants.KeyChainName) + "/check", + ServerURL: hostURL(constants.KeyChainName) + fmt.Sprintf("/check_%v", time.Now().UTC().UnixMicro()), Username: "", // username is ignored on macOS, it's extracted from splitting the server URL Secret: "check", }