Skip to content

Commit

Permalink
test: Add unit test for isHelmReleaseInfo function
Browse files Browse the repository at this point in the history
  • Loading branch information
Niv Weiss committed Jul 20, 2023
1 parent 4d9eeae commit c437eb1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/services/resourceFilterService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func TestPrerequisitesFilters(t *testing.T) {
ShouldValidate: false,
}, ShouldResourceBeValidated(admissionReviewReq, rootObject))
})
t.Run("resource should be skipped because it has Secret kind and name related to Helm release info", func(t *testing.T) {
admissionReviewReq, rootObject := extractAdmissionReviewReqAndRootObject(templateResource)
admissionReviewReq.Request.Kind.Kind = "Secret"
rootObject.Metadata.Name = "sh.helm.release.v1.my-release2.v3.v3"
assert.Equal(t, ShouldValidatedResourceData{
ShouldValidate: false,
}, ShouldResourceBeValidated(admissionReviewReq, rootObject))
})
t.Run("resource should be skipped because namespace is kube-public", func(t *testing.T) {
admissionReviewReq, rootObject := extractAdmissionReviewReqAndRootObject(templateResource)
admissionReviewReq.Request.Namespace = "kube-public"
Expand Down

0 comments on commit c437eb1

Please sign in to comment.