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 9a8d8f6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions pkg/resource/validations/kms_arn_regex_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ 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")
}

if !KmsArnRE.MatchString(*kmsKeyARN) {
return fmt.Errorf("expected the kms-key-arn: %s to match %s", *kmsKeyARN, KmsArnRE)
}
Expand Down
19 changes: 0 additions & 19 deletions pkg/resource/validations/kms_arn_regex_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,6 @@ var _ = Describe("Validations", func() {
kmsKeyARN string
)

BeforeEach(func() {
kmsKeyARN = ""
})

Context("when kmsKeyARN is nil", func() {
It("should return an error", func() {
err := ValidateKMSKeyARN(nil)
Expect(err).To(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"))
})
})

Context("when kmsKeyARN is not empty and matches the regex", func() {
BeforeEach(func() {
kmsKeyARN = "arn:aws:kms:us-east-1:111111111111:key/mrk-0123456789abcdef0123456789abcdef"
Expand Down

0 comments on commit 9a8d8f6

Please sign in to comment.