Skip to content

Commit

Permalink
Init validator object in tests (#2690)
Browse files Browse the repository at this point in the history
Signed-off-by: Mustafa Abdelrahman <[email protected]>
  • Loading branch information
MustafaSaber authored Nov 1, 2023
1 parent d8e4f5f commit ebd4f9d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/webhook/admission/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zalando/skipper/dataclients/kubernetes/definitions"
)

const (
Expand Down Expand Up @@ -146,7 +147,7 @@ func TestRouteGroupAdmitter(t *testing.T) {
req.Header.Set("Content-Type", "application/json")

w := httptest.NewRecorder()
rgAdm := &RouteGroupAdmitter{}
rgAdm := &RouteGroupAdmitter{RouteGroupValidator: &definitions.RouteGroupValidator{}}

h := Handler(rgAdm)
h(w, req)
Expand Down Expand Up @@ -210,7 +211,7 @@ func TestIngressAdmitter(t *testing.T) {
req.Header.Set("Content-Type", "application/json")

w := httptest.NewRecorder()
ingressAdm := &IngressAdmitter{}
ingressAdm := &IngressAdmitter{IngressValidator: &definitions.IngressV1Validator{}}

h := Handler(ingressAdm)
h(w, req)
Expand All @@ -227,8 +228,8 @@ func TestIngressAdmitter(t *testing.T) {
}

func TestMalformedRequests(t *testing.T) {
routeGroupHandler := Handler(&RouteGroupAdmitter{})
ingressHandler := Handler(&IngressAdmitter{})
routeGroupHandler := Handler(&RouteGroupAdmitter{RouteGroupValidator: &definitions.RouteGroupValidator{}})
ingressHandler := Handler(&IngressAdmitter{IngressValidator: &definitions.IngressV1Validator{}})

for _, tc := range []struct {
name string
Expand Down

0 comments on commit ebd4f9d

Please sign in to comment.