Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.19] cleanup: remove secret print in error message #977

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,10 @@ func getStorageAccount(secrets map[string]string) (string, string, error) {
}

if accountName == "" {
return accountName, accountKey, fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, secrets)
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName)
}
if accountKey == "" {
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, secrets)
return accountName, accountKey, fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey)
}

accountName = strings.TrimSpace(accountName)
Expand Down
18 changes: 7 additions & 11 deletions pkg/blob/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,31 +779,31 @@ func TestGetStorageAccount(t *testing.T) {
},
expectedAccountName: "",
expectedAccountKey: "",
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(map[accountname: accountkey:])"),
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field"),
},
{
options: emptyAccountKeyMap,
expectedAccountName: "testaccount",
expectedAccountKey: "",
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAccountKeyMap),
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
},
{
options: emptyAccountNameMap,
expectedAccountName: "",
expectedAccountKey: "testkey",
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAccountNameMap),
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
},
{
options: emptyAzureAccountKeyMap,
expectedAccountName: "testaccount",
expectedAccountKey: "",
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets(%v)", emptyAzureAccountKeyMap),
expectedError: fmt.Errorf("could not find accountkey or azurestorageaccountkey field in secrets"),
},
{
options: emptyAzureAccountNameMap,
expectedAccountName: "",
expectedAccountKey: "testkey",
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field secrets(%v)", emptyAzureAccountNameMap),
expectedError: fmt.Errorf("could not find accountname or azurestorageaccountname field in secrets"),
},
{
options: nil,
Expand Down Expand Up @@ -844,19 +844,15 @@ func TestGetContainerReference(t *testing.T) {
secrets: map[string]string{
"accountKey": fakeAccountKey,
},
expectedError: fmt.Errorf("could not find %s or %s field secrets(%v)", accountNameField, defaultSecretAccountName, map[string]string{
"accountKey": fakeAccountKey,
}),
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountNameField, defaultSecretAccountName),
},
{
name: "failed to retrieve accountKey",
containerName: fakeContainerName,
secrets: map[string]string{
"accountName": fakeAccountName,
},
expectedError: fmt.Errorf("could not find %s or %s field in secrets(%v)", accountKeyField, defaultSecretAccountKey, map[string]string{
"accountName": fakeAccountName,
}),
expectedError: fmt.Errorf("could not find %s or %s field in secrets", accountKeyField, defaultSecretAccountKey),
},
{
name: "failed to obtain client",
Expand Down
Loading