1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

feat: increase verbosity of error message during validation (#3742)

* feat: increase verbosity of error message during validation

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

* removing Equal as we do not have the specific error message there

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

---------

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
This commit is contained in:
Gergely Brautigam 2024-07-29 15:04:35 +02:00 committed by GitHub
parent 586ade7d01
commit 2b51f8a8e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -292,7 +292,7 @@ func testInvalidMtlsStore(tc *framework.TestCase) {
Expect(string(ss.Status.Conditions[0].Type)).Should(Equal("Ready"))
Expect(string(ss.Status.Conditions[0].Status)).Should(Equal("False"))
Expect(ss.Status.Conditions[0].Reason).Should(Equal("ValidationFailed"))
Expect(ss.Status.Conditions[0].Message).Should(Equal("unable to validate store"))
Expect(ss.Status.Conditions[0].Message).Should(ContainSubstring("unable to validate store"))
return true, nil
})
Expect(err).ToNot(HaveOccurred())

View file

@ -35,7 +35,7 @@ const (
errValidationFailed = "could not validate provider: %w"
errPatchStatus = "unable to patch status: %w"
errUnableCreateClient = "unable to create client"
errUnableValidateStore = "unable to validate store"
errUnableValidateStore = "unable to validate store: %s"
errUnableGetProvider = "unable to get store provider"
msgStoreValidated = "store validated"
@ -103,7 +103,7 @@ func validateStore(ctx context.Context, namespace, controllerClass string, store
}
validationResult, err := cl.Validate()
if err != nil && validationResult != esapi.ValidationResultUnknown {
cond := NewSecretStoreCondition(esapi.SecretStoreReady, v1.ConditionFalse, esapi.ReasonValidationFailed, errUnableValidateStore)
cond := NewSecretStoreCondition(esapi.SecretStoreReady, v1.ConditionFalse, esapi.ReasonValidationFailed, fmt.Sprintf(errUnableValidateStore, err))
SetExternalSecretCondition(store, *cond, gaugeVecGetter)
recorder.Event(store, v1.EventTypeWarning, esapi.ReasonValidationFailed, err.Error())
return fmt.Errorf(errValidationFailed, err)