Skip to content

Commit

Permalink
Merge pull request #1385 from splunk/CSPL_2823
Browse files Browse the repository at this point in the history
CSPL-2823 - Addresses PR#1372
  • Loading branch information
akondur authored Oct 10, 2024
2 parents 8393b3c + da71f09 commit 1b1a385
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit 1b1a385

Please sign in to comment.