Skip to content

Commit 8a146df

Browse files
committed
e2e tests
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
1 parent f158470 commit 8a146df

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

test/e2e/testdata/httproute-rewrite-host.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ spec:
3434
- group: gateway.envoyproxy.io
3535
kind: Backend
3636
name: backend-fqdn
37+
- matches:
38+
- path:
39+
type: PathPrefix
40+
value: /path-regex
41+
filters:
42+
- type: ExtensionRef
43+
extensionRef:
44+
group: gateway.envoyproxy.io
45+
kind: HTTPRouteFilter
46+
name: path-regex-host-rewrite
47+
backendRefs:
48+
- name: infra-backend-v1
49+
port: 8080
3750
---
3851
apiVersion: gateway.envoyproxy.io/v1alpha1
3952
kind: HTTPRouteFilter
@@ -57,6 +70,19 @@ spec:
5770
type: Backend
5871
---
5972
apiVersion: gateway.envoyproxy.io/v1alpha1
73+
kind: HTTPRouteFilter
74+
metadata:
75+
name: path-regex-host-rewrite
76+
namespace: gateway-conformance-infra
77+
spec:
78+
urlRewrite:
79+
hostname:
80+
type: PathRegex
81+
pathRegex:
82+
pattern: "^/path-regex/([^/]+).*"
83+
substitution: "\\1.gateway-conformance-infra.svc.cluster.local"
84+
---
85+
apiVersion: gateway.envoyproxy.io/v1alpha1
6086
kind: Backend
6187
metadata:
6288
name: backend-fqdn

test/e2e/tests/httproute_rewrite_host.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ var HTTPRouteRewriteHostHeader = suite.ConformanceTest{
6262
Backend: "infra-backend-v1",
6363
Namespace: ns,
6464
},
65+
{
66+
Request: http.Request{
67+
Path: "/path-regex/infra-backend-v1",
68+
},
69+
ExpectedRequest: &http.ExpectedRequest{
70+
Request: http.Request{
71+
Path: "/path-regex/infra-backend-v1",
72+
Host: "infra-backend-v1.gateway-conformance-infra.svc.cluster.local",
73+
},
74+
},
75+
Backend: "infra-backend-v1",
76+
Namespace: ns,
77+
},
6578
}
6679
for i := range testCases {
6780
// Declare tc here to avoid loop variable

0 commit comments

Comments
 (0)