From ebd4f9d7d501a22f98f348d49226b4caf48cdf2c Mon Sep 17 00:00:00 2001 From: Mustafa Saber Date: Wed, 1 Nov 2023 14:50:07 +0100 Subject: [PATCH] Init validator object in tests (#2690) Signed-off-by: Mustafa Abdelrahman --- cmd/webhook/admission/admission_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/webhook/admission/admission_test.go b/cmd/webhook/admission/admission_test.go index 3fa9a07f7f..a2ad4b26da 100644 --- a/cmd/webhook/admission/admission_test.go +++ b/cmd/webhook/admission/admission_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/zalando/skipper/dataclients/kubernetes/definitions" ) const ( @@ -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) @@ -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) @@ -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