From 4ca8d9139013b6040b019f3f52a70483689c2978 Mon Sep 17 00:00:00 2001 From: den-rgb Date: Fri, 20 Oct 2023 14:04:31 +0100 Subject: [PATCH] OCM-3155 | fix: Removed empty param check --- pkg/resource/validations/kms_arn_regex_validation.go | 2 +- .../validations/kms_arn_regex_validation_test.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/resource/validations/kms_arn_regex_validation.go b/pkg/resource/validations/kms_arn_regex_validation.go index 76adf67..0670e25 100644 --- a/pkg/resource/validations/kms_arn_regex_validation.go +++ b/pkg/resource/validations/kms_arn_regex_validation.go @@ -11,7 +11,7 @@ var KmsArnRE = regexp.MustCompile( func ValidateKMSKeyARN(kmsKeyARN *string) error { if kmsKeyARN == nil || *kmsKeyARN == "" { - return fmt.Errorf("expected a non empty value for kms-key-arn") + return nil } if !KmsArnRE.MatchString(*kmsKeyARN) { diff --git a/pkg/resource/validations/kms_arn_regex_validation_test.go b/pkg/resource/validations/kms_arn_regex_validation_test.go index dd58681..5115e38 100644 --- a/pkg/resource/validations/kms_arn_regex_validation_test.go +++ b/pkg/resource/validations/kms_arn_regex_validation_test.go @@ -17,17 +17,16 @@ var _ = Describe("Validations", func() { }) Context("when kmsKeyARN is nil", func() { - It("should return an error", func() { + It("should not return an error", func() { err := ValidateKMSKeyARN(nil) - Expect(err).To(HaveOccurred()) + Expect(err).ToNot(HaveOccurred()) }) }) Context("when kmsKeyARN is empty", func() { - It("should return an error", func() { + It("should not return an error", func() { err := ValidateKMSKeyARN(&kmsKeyARN) - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(Equal("expected a non empty value for kms-key-arn")) + Expect(err).ToNot(HaveOccurred()) }) })