Skip to content

Commit

Permalink
test/e2e/gateway: Remove redundant tests (projectcontour#4961)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sunjayBhatia authored Jan 11, 2023
1 parent 4a2c1be commit 8c96516
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 47 deletions.
22 changes: 2 additions & 20 deletions test/e2e/gateway/path_condition_match_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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 {
Expand Down
28 changes: 1 addition & 27 deletions test/e2e/gateway/request_redirect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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){
Expand Down

0 comments on commit 8c96516

Please sign in to comment.