Skip to content

Commit c5a9861

Browse files
committed
add test
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
1 parent 5a70070 commit c5a9861

File tree

2 files changed

+374
-60
lines changed

2 files changed

+374
-60
lines changed

internal/gatewayapi/testdata/envoyextensionpolicy-failopen.in.yaml

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ httpRoutes:
5656
kind: HTTPRoute
5757
metadata:
5858
namespace: default
59-
name: httproute-with-valid-and-invalid-extension-failopen # this route should ingore the failed wasm filter
59+
name: httproute-with-invalid-extensions-mixed-failclose-failopen # this route should return 500 direct response
6060
spec:
6161
hostnames:
6262
- www.foo.com
@@ -75,7 +75,7 @@ httpRoutes:
7575
kind: HTTPRoute
7676
metadata:
7777
namespace: default
78-
name: httproute-with-all-invalid-extensions-failopen # this route should ingore all failed extensions
78+
name: httproute-with-invalid-lua-invald-wasm-failopen # this route should return 500 direct response
7979
spec:
8080
hostnames:
8181
- www.foo.com
@@ -90,6 +90,44 @@ httpRoutes:
9090
backendRefs:
9191
- name: service-1
9292
port: 8080
93+
- apiVersion: gateway.networking.k8s.io/v1
94+
kind: HTTPRoute
95+
metadata:
96+
namespace: default
97+
name: httproute-with-valid-and-invalid-extension-failopen # this route should ingore the failed wasm filter
98+
spec:
99+
hostnames:
100+
- www.foo.com
101+
parentRefs:
102+
- namespace: default
103+
name: gateway-1
104+
sectionName: http
105+
rules:
106+
- matches:
107+
- path:
108+
value: /quit
109+
backendRefs:
110+
- name: service-1
111+
port: 8080
112+
- apiVersion: gateway.networking.k8s.io/v1
113+
kind: HTTPRoute
114+
metadata:
115+
namespace: default
116+
name: httproute-with-all-invalid-extensions-failopen # this route should ingore all failed extensions
117+
spec:
118+
hostnames:
119+
- www.foo.com
120+
parentRefs:
121+
- namespace: default
122+
name: gateway-1
123+
sectionName: http
124+
rules:
125+
- matches:
126+
- path:
127+
value: /corge
128+
backendRefs:
129+
- name: service-1
130+
port: 8080
93131
envoyExtensionPolicies:
94132
- apiVersion: gateway.envoyproxy.io/v1alpha1
95133
kind: EnvoyExtensionPolicy
@@ -113,6 +151,58 @@ envoyExtensionPolicies:
113151
http:
114152
url: https://www.example.com/non-existent.wasm
115153
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
154+
- apiVersion: gateway.envoyproxy.io/v1alpha1
155+
kind: EnvoyExtensionPolicy
156+
metadata:
157+
namespace: default
158+
name: policy-for-httproute-with-invalid-extensions-mixed-failclose-failopen
159+
spec:
160+
targetRefs:
161+
- group: gateway.networking.k8s.io
162+
kind: HTTPRoute
163+
name: httproute-with-invalid-extensions-mixed-failclose-failopen
164+
extProc:
165+
- backendRefs:
166+
- Name: backend-not-exist
167+
Kind: Backend
168+
Group: gateway.envoyproxy.io
169+
wasm:
170+
- name: wasm-filter-1
171+
code:
172+
type: HTTP
173+
http:
174+
url: https://www.example.com/non-existent.wasm
175+
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
176+
failOpen: true
177+
- apiVersion: gateway.envoyproxy.io/v1alpha1
178+
kind: EnvoyExtensionPolicy
179+
metadata:
180+
namespace: default
181+
name: policy-for-httproute-with-invalid-lua-invald-wasm-failopen
182+
spec:
183+
targetRefs:
184+
- group: gateway.networking.k8s.io
185+
kind: HTTPRoute
186+
name: httproute-with-invalid-lua-invald-wasm-failopen
187+
lua:
188+
- type: Inline
189+
inline: "function non_existing_function(request_handle)
190+
request_handle:logInfo('Goodbye.')
191+
end"
192+
extProc:
193+
- backendRefs:
194+
- Name: backend-not-exist
195+
Kind: Backend
196+
Group: gateway.envoyproxy.io
197+
failOpen: true
198+
wasm:
199+
- name: wasm-filter-1
200+
code:
201+
type: HTTP
202+
http:
203+
url: https://www.example.com/non-existent.wasm
204+
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
205+
failOpen: true
116206
- apiVersion: gateway.envoyproxy.io/v1alpha1
117207
kind: EnvoyExtensionPolicy
118208
metadata:

0 commit comments

Comments
 (0)