Skip to content

Commit 24fb89a

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
cleanup: remove secret print in error message
1 parent d364084 commit 24fb89a

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
@@ -728,10 +728,10 @@ func getStorageAccount(secrets map[string]string) (string, string, error) {
728728
}
729729

730730
if accountName == "" {
731-
return accountName, accountKey, fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, secrets)
731+
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName)
732732
}
733733
if accountKey == "" {
734-
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, secrets)
734+
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey)
735735
}
736736

737737
accountName = strings.TrimSpace(accountName)

pkg/blob/blob_test.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -840,31 +840,31 @@ func TestGetStorageAccount(t *testing.T) {
840840
},
841841
expectedAccountName: "",
842842
expectedAccountKey: "",
843-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(map[accountname: accountkey:])"),
843+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field"),
844844
},
845845
{
846846
options: emptyAccountKeyMap,
847847
expectedAccountName: "testaccount",
848848
expectedAccountKey: "",
849-
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAccountKeyMap),
849+
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
850850
},
851851
{
852852
options: emptyAccountNameMap,
853853
expectedAccountName: "",
854854
expectedAccountKey: "testkey",
855-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAccountNameMap),
855+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
856856
},
857857
{
858858
options: emptyAzureAccountKeyMap,
859859
expectedAccountName: "testaccount",
860860
expectedAccountKey: "",
861-
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAzureAccountKeyMap),
861+
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
862862
},
863863
{
864864
options: emptyAzureAccountNameMap,
865865
expectedAccountName: "",
866866
expectedAccountKey: "testkey",
867-
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAzureAccountNameMap),
867+
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
868868
},
869869
{
870870
options: nil,
@@ -905,19 +905,15 @@ func TestGetContainerReference(t *testing.T) {
905905
secrets: map[string]string{
906906
"accountKey": fakeAccountKey,
907907
},
908-
expectedError: fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, map[string]string{
909-
"accountKey": fakeAccountKey,
910-
}),
908+
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName),
911909
},
912910
{
913911
name: "failed to retrieve accountKey",
914912
containerName: fakeContainerName,
915913
secrets: map[string]string{
916914
"accountName": fakeAccountName,
917915
},
918-
expectedError: fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, map[string]string{
919-
"accountName": fakeAccountName,
920-
}),
916+
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey),
921917
},
922918
{
923919
name: "failed to obtain client",

0 commit comments

Comments
 (0)