Skip to content

Commit c709a4f

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
cleanup: remove secret print in error message
1 parent 7a0b588 commit c709a4f

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

pkg/blob/blob.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,10 @@ func getStorageAccount(secrets map[string]string) (string, string, error) {
716716
}
717717

718718
if accountName == "" {
719-
return accountName, accountKey, fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, secrets)
719+
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName)
720720
}
721721
if accountKey == "" {
722-
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, secrets)
722+
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey)
723723
}
724724

725725
accountName = strings.TrimSpace(accountName)

pkg/blob/blob_test.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,31 +779,31 @@ func TestGetStorageAccount(t *testing.T) {
779779
},
780780
expectedAccountName: "",
781781
expectedAccountKey: "",
782-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(map[accountname: accountkey:])"),
782+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field"),
783783
},
784784
{
785785
options: emptyAccountKeyMap,
786786
expectedAccountName: "testaccount",
787787
expectedAccountKey: "",
788-
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAccountKeyMap),
788+
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
789789
},
790790
{
791791
options: emptyAccountNameMap,
792792
expectedAccountName: "",
793793
expectedAccountKey: "testkey",
794-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAccountNameMap),
794+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
795795
},
796796
{
797797
options: emptyAzureAccountKeyMap,
798798
expectedAccountName: "testaccount",
799799
expectedAccountKey: "",
800-
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAzureAccountKeyMap),
800+
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
801801
},
802802
{
803803
options: emptyAzureAccountNameMap,
804804
expectedAccountName: "",
805805
expectedAccountKey: "testkey",
806-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAzureAccountNameMap),
806+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
807807
},
808808
{
809809
options: nil,
@@ -844,19 +844,15 @@ func TestGetContainerReference(t *testing.T) {
844844
secrets: map[string]string{
845845
"accountKey": fakeAccountKey,
846846
},
847-
expectedError: fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, map[string]string{
848-
"accountKey": fakeAccountKey,
849-
}),
847+
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName),
850848
},
851849
{
852850
name: "failed to retrieve accountKey",
853851
containerName: fakeContainerName,
854852
secrets: map[string]string{
855853
"accountName": fakeAccountName,
856854
},
857-
expectedError: fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, map[string]string{
858-
"accountName": fakeAccountName,
859-
}),
855+
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey),
860856
},
861857
{
862858
name: "failed to obtain client",

0 commit comments

Comments
 (0)