Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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