Skip to content

Commit 8455177

Browse files
authored
e2e: refactor ratelmit test (#5997)
Signed-off-by: zirain <[email protected]>
1 parent b9bcec7 commit 8455177

File tree

3 files changed

+153
-193
lines changed

3 files changed

+153
-193
lines changed

test/e2e/testdata/local-ratelimit.yaml

Lines changed: 85 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ metadata:
55
namespace: gateway-conformance-infra
66
spec:
77
targetRefs:
8-
- group: gateway.networking.k8s.io
9-
kind: HTTPRoute
10-
name: http-ratelimit-specific-user
8+
- group: gateway.networking.k8s.io
9+
kind: HTTPRoute
10+
name: http-ratelimit-specific-user
1111
rateLimit:
1212
type: Local
1313
local:
1414
rules:
15-
- limit:
16-
requests: 10
17-
unit: Hour
18-
- clientSelectors:
19-
- headers:
20-
- name: x-user-id
21-
value: john
22-
limit:
23-
requests: 3
24-
unit: Hour
15+
- limit:
16+
requests: 10
17+
unit: Hour
18+
- clientSelectors:
19+
- headers:
20+
- name: x-user-id
21+
value: john
22+
limit:
23+
requests: 3
24+
unit: Hour
2525
---
2626
apiVersion: gateway.envoyproxy.io/v1alpha1
2727
kind: BackendTrafficPolicy
@@ -30,16 +30,16 @@ metadata:
3030
namespace: gateway-conformance-infra
3131
spec:
3232
targetRefs:
33-
- group: gateway.networking.k8s.io
34-
kind: HTTPRoute
35-
name: http-ratelimit-all-traffic
33+
- group: gateway.networking.k8s.io
34+
kind: HTTPRoute
35+
name: http-ratelimit-all-traffic
3636
rateLimit:
3737
type: Local
3838
local:
3939
rules:
40-
- limit:
41-
requests: 3
42-
unit: Hour
40+
- limit:
41+
requests: 3
42+
unit: Hour
4343
---
4444
apiVersion: gateway.networking.k8s.io/v1
4545
kind: HTTPRoute
@@ -48,15 +48,15 @@ metadata:
4848
namespace: gateway-conformance-infra
4949
spec:
5050
parentRefs:
51-
- name: same-namespace
51+
- name: same-namespace
5252
rules:
53-
- backendRefs:
54-
- name: infra-backend-v1
55-
port: 8080
56-
matches:
57-
- path:
58-
type: Exact
59-
value: /ratelimit-specific-user
53+
- backendRefs:
54+
- name: infra-backend-v1
55+
port: 8080
56+
matches:
57+
- path:
58+
type: Exact
59+
value: /ratelimit-specific-user
6060
---
6161
apiVersion: gateway.networking.k8s.io/v1
6262
kind: HTTPRoute
@@ -65,15 +65,15 @@ metadata:
6565
namespace: gateway-conformance-infra
6666
spec:
6767
parentRefs:
68-
- name: same-namespace
68+
- name: same-namespace
6969
rules:
70-
- backendRefs:
71-
- name: infra-backend-v1
72-
port: 8080
73-
matches:
74-
- path:
75-
type: Exact
76-
value: /ratelimit-all-traffic
70+
- backendRefs:
71+
- name: infra-backend-v1
72+
port: 8080
73+
matches:
74+
- path:
75+
type: Exact
76+
value: /ratelimit-all-traffic
7777
---
7878
apiVersion: gateway.networking.k8s.io/v1
7979
kind: HTTPRoute
@@ -82,12 +82,54 @@ metadata:
8282
namespace: gateway-conformance-infra
8383
spec:
8484
parentRefs:
85-
- name: same-namespace
85+
- name: same-namespace
8686
rules:
87-
- backendRefs:
88-
- name: infra-backend-v1
89-
port: 8080
90-
matches:
91-
- path:
92-
type: Exact
93-
value: /no-ratelimit
87+
- backendRefs:
88+
- name: infra-backend-v1
89+
port: 8080
90+
matches:
91+
- path:
92+
type: Exact
93+
value: /no-ratelimit
94+
---
95+
apiVersion: gateway.envoyproxy.io/v1alpha1
96+
kind: BackendTrafficPolicy
97+
metadata:
98+
name: ratelimit-invert-match
99+
namespace: gateway-conformance-infra
100+
spec:
101+
targetRefs:
102+
- group: gateway.networking.k8s.io
103+
kind: HTTPRoute
104+
name: http-ratelimit-invert-match
105+
rateLimit:
106+
type: Local
107+
local:
108+
rules:
109+
- clientSelectors:
110+
- headers:
111+
- name: x-user-id
112+
value: one
113+
- name: x-org-id
114+
value: test
115+
invert: true
116+
limit:
117+
requests: 3
118+
unit: Hour
119+
---
120+
apiVersion: gateway.networking.k8s.io/v1
121+
kind: HTTPRoute
122+
metadata:
123+
name: http-ratelimit-invert-match
124+
namespace: gateway-conformance-infra
125+
spec:
126+
parentRefs:
127+
- name: same-namespace
128+
rules:
129+
- backendRefs:
130+
- name: infra-backend-v1
131+
port: 8080
132+
matches:
133+
- path:
134+
type: Exact
135+
value: /ratelimit-invert-match

test/e2e/testdata/ratelimit-header-invert-match-local.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)