Skip to content

Commit 18be01b

Browse files
sunjayBhatiayangyy93
authored andcommitted
test/e2e/gateway: Remove redundant tests (projectcontour#4961)
Remove test cases for path matching Covered by conformance tests for exact path matching and prefix path matching 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 <[email protected]> Signed-off-by: yy <[email protected]>
1 parent 3ace1bd commit 18be01b

File tree

2 files changed

+3
-47
lines changed

2 files changed

+3
-47
lines changed

test/e2e/gateway/path_condition_match_test.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ func testGatewayPathConditionMatch(namespace string, gateway types.NamespacedNam
5151
Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/path/prefix"),
5252
BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-prefix", 80, 1),
5353
},
54-
55-
{
56-
Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchExact, "/path/exact"),
57-
BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-exact", 80, 1),
58-
},
59-
6054
{
6155
Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/"),
6256
BackendRefs: gatewayapi.HTTPBackendRef("echo-slash-default", 80, 1),
@@ -67,20 +61,8 @@ func testGatewayPathConditionMatch(namespace string, gateway types.NamespacedNam
6761
f.CreateHTTPRouteAndWaitFor(route, httpRouteAccepted)
6862

6963
cases := map[string]string{
70-
"/": "echo-slash-default",
71-
"/foo": "echo-slash-default",
72-
73-
"/path/prefix": "echo-slash-prefix",
74-
"/path/prefix/": "echo-slash-prefix",
75-
"/path/prefix/foo": "echo-slash-prefix",
76-
"/path/prefix/foo/bar": "echo-slash-prefix",
77-
"/path/prefixfoo": "echo-slash-default", // not a segment prefix match
78-
"/foo/path/prefix": "echo-slash-default",
79-
80-
"/path/exact": "echo-slash-exact",
81-
"/path/exactfoo": "echo-slash-default",
82-
"/path/exact/": "echo-slash-default",
83-
"/path/exact/foo": "echo-slash-default",
64+
"/path/prefix/": "echo-slash-prefix",
65+
"/path/prefixfoo": "echo-slash-default", // not a segment prefix match
8466
}
8567

8668
for path, expectedService := range cases {

test/e2e/gateway/request_redirect_test.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@ func testRequestRedirectRule(namespace string, gateway types.NamespacedName) {
4949
},
5050
},
5151
Rules: []gatewayapi_v1beta1.HTTPRouteRule{
52-
{
53-
Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/basic-redirect"),
54-
Filters: []gatewayapi_v1beta1.HTTPRouteFilter{
55-
{
56-
Type: gatewayapi_v1beta1.HTTPRouteFilterRequestRedirect,
57-
RequestRedirect: &gatewayapi_v1beta1.HTTPRequestRedirectFilter{
58-
Hostname: ref.To(gatewayapi_v1beta1.PreciseHostname("projectcontour.io")),
59-
},
60-
},
61-
},
62-
BackendRefs: gatewayapi.HTTPBackendRef("echo", 80, 1),
63-
},
6452
{
6553
Matches: gatewayapi.HTTPRouteMatch(gatewayapi_v1beta1.PathMatchPathPrefix, "/complex-redirect"),
6654
Filters: []gatewayapi_v1beta1.HTTPRouteFilter{
@@ -81,24 +69,10 @@ func testRequestRedirectRule(namespace string, gateway types.NamespacedName) {
8169
}
8270
f.CreateHTTPRouteAndWaitFor(route, httpRouteAccepted)
8371

84-
// /basic-redirect only specifies a host name to
85-
// redirect to.
86-
res, ok := f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{
87-
Host: string(route.Spec.Hostnames[0]),
88-
Path: "/basic-redirect",
89-
ClientOpts: []func(*http.Client){
90-
e2e.OptDontFollowRedirects,
91-
},
92-
Condition: e2e.HasStatusCode(302),
93-
})
94-
require.NotNil(t, res, "request never succeeded")
95-
require.Truef(t, ok, "expected 302 response code, got %d", res.StatusCode)
96-
assert.Equal(t, "http://projectcontour.io/basic-redirect", res.Headers.Get("Location"))
97-
9872
// /complex-redirect specifies a host name,
9973
// scheme, port and response code for the
10074
// redirect.
101-
res, ok = f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{
75+
res, ok := f.HTTP.RequestUntil(&e2e.HTTPRequestOpts{
10276
Host: string(route.Spec.Hostnames[0]),
10377
Path: "/complex-redirect",
10478
ClientOpts: []func(*http.Client){

0 commit comments

Comments
 (0)