Skip to content

Commit 1011206

Browse files
committed
attempt to fix test
1 parent 5bcb1ee commit 1011206

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

apis/v1alpha2/validation/httproute_test.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929

3030
func TestValidateHTTPRoute(t *testing.T) {
3131
testService := gatewayv1a2.ObjectName("test-service")
32-
specialService := gatewayv1a2.ObjectName("special-service")
3332
pathPrefixMatchType := gatewayv1b1.PathMatchPathPrefix
3433

3534
tests := []struct {
@@ -173,7 +172,7 @@ func TestValidateHTTPRoute(t *testing.T) {
173172
},
174173
}, {
175174
name: "invalid httpRoute with multiple duplicate filters",
176-
errCount: 1,
175+
errCount: 2,
177176
rules: []gatewayv1a2.HTTPRouteRule{
178177
{
179178
Matches: []gatewayv1a2.HTTPRouteMatch{
@@ -229,15 +228,6 @@ func TestValidateHTTPRoute(t *testing.T) {
229228
},
230229
},
231230
},
232-
{
233-
Type: gatewayv1b1.HTTPRouteFilterRequestMirror,
234-
RequestMirror: &gatewayv1a2.HTTPRequestMirrorFilter{
235-
BackendRef: gatewayv1a2.BackendObjectReference{
236-
Name: specialService,
237-
Port: ptrTo(gatewayv1b1.PortNumber(8080)),
238-
},
239-
},
240-
},
241231
},
242232
},
243233
},

apis/v1beta1/validation/httproute_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828

2929
func TestValidateHTTPRoute(t *testing.T) {
3030
testService := gatewayv1b1.ObjectName("test-service")
31-
specialService := gatewayv1b1.ObjectName("special-service")
3231
pathPrefixMatchType := gatewayv1b1.PathMatchPathPrefix
3332

3433
tests := []struct {
@@ -612,7 +611,7 @@ func TestValidateHTTPBackendUniqueFilters(t *testing.T) {
612611
}},
613612
}, {
614613
name: "valid httpRoute Rules duplicate mirror filter",
615-
errCount: 2,
614+
errCount: 0,
616615
rules: []gatewayv1b1.HTTPRouteRule{{
617616
BackendRefs: []gatewayv1b1.HTTPBackendRef{
618617
{

pkg/admission/server_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func TestServeHTTPSubmissions(t *testing.T) {
235235
},
236236
},
237237
{
238-
name: "invalid v1alpha2 HTTPRoute resource with two request mirror filters",
238+
name: "valid v1alpha2 HTTPRoute resource with two request mirror filters",
239239
reqBody: dedent.Dedent(`{
240240
"kind": "AdmissionReview",
241241
"apiVersion": "` + apiVersion + `",
@@ -301,11 +301,8 @@ func TestServeHTTPSubmissions(t *testing.T) {
301301
wantRespCode: http.StatusOK,
302302
wantSuccessResponse: admission.AdmissionResponse{
303303
UID: "7313cd05-eddc-4150-b88c-971a0d53b2ab",
304-
Allowed: false,
305-
Result: &metav1.Status{
306-
Code: 400,
307-
Message: "spec.rules[0].filters: Invalid value: \"RequestMirror\": cannot be used multiple times in the same rule",
308-
},
304+
Allowed: true,
305+
Result: &metav1.Status{},
309306
},
310307
},
311308
{

0 commit comments

Comments
 (0)