Skip to content

Commit

Permalink
OCM-3155 | fix: Removed empty param check
Browse files Browse the repository at this point in the history
  • Loading branch information
den-rgb committed Oct 20, 2023
1 parent d0be7f2 commit 438ec39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/resource/validations/kms_arn_regex_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/resource/validations/kms_arn_regex_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ var _ = Describe("Validations", func() {
Context("when kmsKeyARN is nil", func() {
It("should 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() {
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())
})
})

Expand Down

0 comments on commit 438ec39

Please sign in to comment.