Skip to content

Commit

Permalink
Change to lowercase urlRewrite in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ciarams87 committed May 2, 2024
1 parent db46a49 commit 07cbf95
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/mode/static/state/graph/httproute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
},
Expand All @@ -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
Expand All @@ -1061,7 +1061,7 @@ func TestValidateFilterRewrite(t *testing.T) {
},
{
validator: &validationfakes.FakeHTTPFieldsValidator{},
URLRewrite: &gatewayv1.HTTPURLRewriteFilter{
urlRewrite: &gatewayv1.HTTPURLRewriteFilter{
Path: &gatewayv1.HTTPPathModifier{
Type: "bad-type",
},
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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
Expand All @@ -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))
})
}
Expand Down

0 comments on commit 07cbf95

Please sign in to comment.