From 07cbf95f5bed8e990563295081c73406beed1390 Mon Sep 17 00:00:00 2001 From: Ciara Stacke Date: Wed, 1 May 2024 19:39:42 +0100 Subject: [PATCH] Change to lowercase urlRewrite in tests --- .../mode/static/state/graph/httproute_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/mode/static/state/graph/httproute_test.go b/internal/mode/static/state/graph/httproute_test.go index 6872416205..22811add6e 100644 --- a/internal/mode/static/state/graph/httproute_test.go +++ b/internal/mode/static/state/graph/httproute_test.go @@ -1016,20 +1016,20 @@ func TestValidateFilterRedirect(t *testing.T) { func TestValidateFilterRewrite(t *testing.T) { tests := []struct { - URLRewrite *gatewayv1.HTTPURLRewriteFilter + urlRewrite *gatewayv1.HTTPURLRewriteFilter validator *validationfakes.FakeHTTPFieldsValidator name string expectErrCount int }{ { validator: &validationfakes.FakeHTTPFieldsValidator{}, - URLRewrite: nil, + urlRewrite: nil, name: "nil filter", expectErrCount: 1, }, { validator: &validationfakes.FakeHTTPFieldsValidator{}, - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Hostname: helpers.GetPointer[gatewayv1.PreciseHostname]("example.com"), Path: &gatewayv1.HTTPPathModifier{ Type: gatewayv1.FullPathHTTPPathModifier, @@ -1041,7 +1041,7 @@ func TestValidateFilterRewrite(t *testing.T) { }, { validator: &validationfakes.FakeHTTPFieldsValidator{}, - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{}, + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{}, expectErrCount: 0, name: "valid rewrite filter with no fields set", }, @@ -1051,7 +1051,7 @@ func TestValidateFilterRewrite(t *testing.T) { validator.ValidateHostnameReturns(errors.New("invalid hostname")) return validator }(), - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Hostname: helpers.GetPointer[gatewayv1.PreciseHostname]( "example.com", ), // any value is invalid by the validator @@ -1061,7 +1061,7 @@ func TestValidateFilterRewrite(t *testing.T) { }, { validator: &validationfakes.FakeHTTPFieldsValidator{}, - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Path: &gatewayv1.HTTPPathModifier{ Type: "bad-type", }, @@ -1075,7 +1075,7 @@ func TestValidateFilterRewrite(t *testing.T) { validator.ValidateRewritePathReturns(errors.New("invalid path value")) return validator }(), - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Path: &gatewayv1.HTTPPathModifier{ Type: gatewayv1.FullPathHTTPPathModifier, ReplaceFullPath: helpers.GetPointer("/path"), @@ -1090,7 +1090,7 @@ func TestValidateFilterRewrite(t *testing.T) { validator.ValidateRewritePathReturns(errors.New("invalid path")) return validator }(), - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Path: &gatewayv1.HTTPPathModifier{ Type: gatewayv1.PrefixMatchHTTPPathModifier, ReplacePrefixMatch: helpers.GetPointer("/path"), @@ -1106,7 +1106,7 @@ func TestValidateFilterRewrite(t *testing.T) { validator.ValidateRewritePathReturns(errors.New("invalid path")) return validator }(), - URLRewrite: &gatewayv1.HTTPURLRewriteFilter{ + urlRewrite: &gatewayv1.HTTPURLRewriteFilter{ Hostname: helpers.GetPointer[gatewayv1.PreciseHostname]( "example.com", ), // any value is invalid by the validator @@ -1125,7 +1125,7 @@ func TestValidateFilterRewrite(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { g := NewWithT(t) - allErrs := validateFilterRewrite(test.validator, test.URLRewrite, filterPath) + allErrs := validateFilterRewrite(test.validator, test.urlRewrite, filterPath) g.Expect(allErrs).To(HaveLen(test.expectErrCount)) }) }