From f71afec0850c85969cb08579aaf4df8ed7cb99f0 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Thu, 5 Jan 2023 18:56:52 +0000 Subject: [PATCH 1/2] test/e2e/gateway: Remove test cases for path matching Covered by conformance tests for exact path matching and prefix path matching Still need to contribute a couple prefix match cases back upstream before we can delete this test completely Signed-off-by: Sunjay Bhatia --- test/e2e/gateway/path_condition_match_test.go | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/test/e2e/gateway/path_condition_match_test.go b/test/e2e/gateway/path_condition_match_test.go index 65324f6e0f3..a43667008c9 100644 --- a/test/e2e/gateway/path_condition_match_test.go +++ b/test/e2e/gateway/path_condition_match_test.go @@ -51,12 +51,6 @@ func testGatewayPathConditionMatch(namespace string, gateway types.NamespacedNam Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/path/prefix"), BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-prefix", 80, 1), }, - - { - Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchExact, "/path/exact"), - BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-exact", 80, 1), - }, - { Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/"), BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-default", 80, 1), @@ -67,20 +61,8 @@ func testGatewayPathConditionMatch(namespace string, gateway types.NamespacedNam f.CreateHTTPRouteAndWaitFor(route, httpRouteAccepted) cases := map[string]string{ - "/": "echo-slash-default", - "/foo": "echo-slash-default", - - "/path/prefix": "echo-slash-prefix", - "/path/prefix/": "echo-slash-prefix", - "/path/prefix/foo": "echo-slash-prefix", - "/path/prefix/foo/bar": "echo-slash-prefix", - "/path/prefixfoo": "echo-slash-default", // not a segment prefix match - "/foo/path/prefix": "echo-slash-default", - - "/path/exact": "echo-slash-exact", - "/path/exactfoo": "echo-slash-default", - "/path/exact/": "echo-slash-default", - "/path/exact/foo": "echo-slash-default", + "/path/prefix/": "echo-slash-prefix", + "/path/prefixfoo": "echo-slash-default", // not a segment prefix match } for path, expectedService := range cases { From bf0978cd31ccc0a487b69151b725f3eb82e43f9e Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Thu, 5 Jan 2023 19:02:07 +0000 Subject: [PATCH 2/2] test/e2e/gateway: Remove basic path redirect test Covered in Gateway API v0.6.0 More advanced features are not covered in the latest release but are on main, so we cannot remove those cases yet. Signed-off-by: Sunjay Bhatia --- test/e2e/gateway/request_redirect_test.go | 28 +---------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/test/e2e/gateway/request_redirect_test.go b/test/e2e/gateway/request_redirect_test.go index 08765e20974..2db2dbfdd02 100644 --- a/test/e2e/gateway/request_redirect_test.go +++ b/test/e2e/gateway/request_redirect_test.go @@ -49,18 +49,6 @@ func testRequestRedirectRule(namespace string, gateway types.NamespacedName) { }, }, Rules: []gatewayapi_v1beta1.HTTPRouteRule{ - { - Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/basic-redirect"), - Filters: []gatewayapi_v1beta1.HTTPRouteFilter{ - { - Type: gatewayapi_v1beta1.HTTPRouteFilterRequestRedirect, - RequestRedirect: &gatewayapi_v1beta1.HTTPRequestRedirectFilter{ - Hostname: ref.To(gatewayapi_v1beta1.PreciseHostname("projectcontour.io")), - }, - }, - }, - BackendRefs: gatewayapi.HTTPBackendRef("echo", 80, 1), - }, { Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/complex-redirect"), Filters: []gatewayapi_v1beta1.HTTPRouteFilter{ @@ -81,24 +69,10 @@ func testRequestRedirectRule(namespace string, gateway types.NamespacedName) { } f.CreateHTTPRouteAndWaitFor(route, httpRouteAccepted) - // /basic-redirect only specifies a host name to - // redirect to. - res, ok := f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{ - Host: string(route.Spec.Hostnames[0]), - Path: "/basic-redirect", - ClientOpts: []func(*http.Client){ - e2e.OptDontFollowRedirects, - }, - Condition: e2e.HasStatusCode(302), - }) - require.NotNil(t, res, "request never succeeded") - require.Truef(t, ok, "expected 302 response code, got %d", res.StatusCode) - assert.Equal(t, "http://projectcontour.io/basic-redirect", res.Headers.Get("Location")) - // /complex-redirect specifies a host name, // scheme, port and response code for the // redirect. - res, ok = f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{ + res, ok := f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{ Host: string(route.Spec.Hostnames[0]), Path: "/complex-redirect", ClientOpts: []func(*http.Client){