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

CSPL-2823 - Addresses PR#1372 #1385

Merged
merged 4 commits into from
Oct 10, 2024
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/splunk/enterprise/searchheadcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func ApplyShcSecret(ctx context.Context, mgr *searchHeadClusterPodManager, repli
// Retrieve shc_secret password from Pod
shcSecret, err := splutil.GetSpecificSecretTokenFromPod(ctx, mgr.c, shPodName, mgr.cr.GetNamespace(), "shc_secret")
if err != nil {
return fmt.Errorf("couldn't retrieve shc_secret from secret data")
return fmt.Errorf("couldn't retrieve shc_secret from secret data, error: %s", err.Error())
}

// set the targetPodName here
Expand All @@ -320,7 +320,7 @@ func ApplyShcSecret(ctx context.Context, mgr *searchHeadClusterPodManager, repli
// Retrieve admin password from Pod
adminPwd, err := splutil.GetSpecificSecretTokenFromPod(ctx, mgr.c, shPodName, mgr.cr.GetNamespace(), "password")
if err != nil {
return fmt.Errorf("couldn't retrieve admin password from secret data")
return fmt.Errorf("couldn't retrieve admin password from secret data, error: %s", err.Error())
}

// If shc secret is different from namespace scoped secret change it
Expand Down
7 changes: 5 additions & 2 deletions pkg/splunk/enterprise/searchheadcluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,10 @@ func TestApplyShcSecret(t *testing.T) {
t.Errorf("Couldn't update resource")
}

errMsg := fmt.Sprintf(splcommon.SecretTokenNotRetrievable, "shc_secret") + ", error: invalid secret data"

err = ApplyShcSecret(ctx, mgr, 1, mockPodExecClient)
if err.Error() != fmt.Sprintf(splcommon.SecretTokenNotRetrievable, "shc_secret") {
if err.Error() != errMsg {
t.Errorf("Couldn't recognize missing shc_secret %s", err.Error())
}

Expand All @@ -621,8 +623,9 @@ func TestApplyShcSecret(t *testing.T) {
t.Errorf("Couldn't update resource")
}

errMsg = fmt.Sprintf(splcommon.SecretTokenNotRetrievable, "admin password") + ", error: invalid secret data"
err = ApplyShcSecret(ctx, mgr, 1, mockPodExecClient)
if err.Error() != fmt.Sprintf(splcommon.SecretTokenNotRetrievable, "admin password") {
if err.Error() != errMsg {
t.Errorf("Couldn't recognize missing admin password %s", err.Error())
}

Expand Down
Loading