Skip to content

Commit

Permalink
Merge pull request #18 from den-rgb/OCM-3155-fix
Browse files Browse the repository at this point in the history
OCM-3155 | fix: Removed empty param check
  • Loading branch information
ciaranRoche authored Oct 23, 2023
2 parents d0be7f2 + 4ca8d91 commit 1e92673
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 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
9 changes: 4 additions & 5 deletions pkg/resource/validations/kms_arn_regex_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
})

Expand Down

0 comments on commit 1e92673

Please sign in to comment.