Skip to content

Commit 9d406b0

Browse files
thc1006steveyiyo
andcommitted
test: add golden files for frontend unit tests
Add baseline golden output files for frontend policy unit test cases. These files establish expected translation outputs for TCP, TLS, HTTP, AccessLog configurations and combinations. Generated using REFRESH_GOLDEN=true test execution. This completes Task 1 (unit tests) of issue #12816. Task 2 (E2E tests) will be addressed in a follow-up PR to maintain small, focused pull requests following the Small CL principle. Partial: #12816 Signed-off-by: thc1006 <[email protected]> Co-authored-by: SteveYi <[email protected]>
1 parent 8a3aaf7 commit 9d406b0

12 files changed

+324
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
namespace: default
6+
spec: null
7+
status:
8+
parents:
9+
- conditions:
10+
- lastTransitionTime: fake
11+
message: ""
12+
reason: Accepted
13+
status: "True"
14+
type: Accepted
15+
- lastTransitionTime: fake
16+
message: ""
17+
reason: ResolvedRefs
18+
status: "True"
19+
type: ResolvedRefs
20+
controllerName: kgateway.dev/agentgateway
21+
parentRef:
22+
group: gateway.networking.k8s.io
23+
kind: Gateway
24+
name: example-gateway
25+
namespace: default
26+
---
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Addresses:
2+
- service:
3+
hostname: example-svc.default.svc.cluster.local
4+
name: example-svc
5+
namespace: default
6+
ports:
7+
- servicePort: 8080
8+
Binds:
9+
- key: 80/default/example-gateway
10+
port: 80
11+
Listeners:
12+
- bindKey: 80/default/example-gateway
13+
gatewayName: default/example-gateway
14+
key: default/example-gateway.http
15+
name: http
16+
protocol: HTTP
17+
Routes:
18+
- backends:
19+
- backend:
20+
port: 8080
21+
service: default/example-svc.default.svc.cluster.local
22+
weight: 1
23+
hostnames:
24+
- example.com
25+
key: default/example-route.0.0.http
26+
listenerKey: default/example-gateway.http
27+
matches:
28+
- path:
29+
pathPrefix: /
30+
routeName: default/example-route
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
namespace: default
6+
spec: null
7+
status:
8+
parents:
9+
- conditions:
10+
- lastTransitionTime: fake
11+
message: ""
12+
reason: Accepted
13+
status: "True"
14+
type: Accepted
15+
- lastTransitionTime: fake
16+
message: ""
17+
reason: ResolvedRefs
18+
status: "True"
19+
type: ResolvedRefs
20+
controllerName: kgateway.dev/agentgateway
21+
parentRef:
22+
group: gateway.networking.k8s.io
23+
kind: Gateway
24+
name: example-gateway
25+
namespace: default
26+
---
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Addresses:
2+
- service:
3+
hostname: example-svc.default.svc.cluster.local
4+
name: example-svc
5+
namespace: default
6+
ports:
7+
- servicePort: 8080
8+
Binds:
9+
- key: 443/default/example-gateway
10+
port: 443
11+
Routes:
12+
- backends:
13+
- backend:
14+
port: 8080
15+
service: default/example-svc.default.svc.cluster.local
16+
weight: 1
17+
hostnames:
18+
- example.com
19+
key: default/example-route.0.0.https
20+
listenerKey: default/example-gateway.https
21+
matches:
22+
- path:
23+
pathPrefix: /
24+
routeName: default/example-route
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
namespace: default
6+
spec: null
7+
status:
8+
parents:
9+
- conditions:
10+
- lastTransitionTime: fake
11+
message: ""
12+
reason: Accepted
13+
status: "True"
14+
type: Accepted
15+
- lastTransitionTime: fake
16+
message: ""
17+
reason: ResolvedRefs
18+
status: "True"
19+
type: ResolvedRefs
20+
controllerName: kgateway.dev/agentgateway
21+
parentRef:
22+
group: gateway.networking.k8s.io
23+
kind: Gateway
24+
name: example-gateway
25+
namespace: default
26+
---
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Addresses:
2+
- service:
3+
hostname: example-svc.default.svc.cluster.local
4+
name: example-svc
5+
namespace: default
6+
ports:
7+
- servicePort: 8080
8+
Binds:
9+
- key: 80/default/example-gateway
10+
port: 80
11+
Listeners:
12+
- bindKey: 80/default/example-gateway
13+
gatewayName: default/example-gateway
14+
key: default/example-gateway.http
15+
name: http
16+
protocol: HTTP
17+
Routes:
18+
- backends:
19+
- backend:
20+
port: 8080
21+
service: default/example-svc.default.svc.cluster.local
22+
weight: 1
23+
hostnames:
24+
- example.com
25+
key: default/example-route.0.0.http
26+
listenerKey: default/example-gateway.http
27+
matches:
28+
- path:
29+
pathPrefix: /
30+
routeName: default/example-route
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
namespace: default
6+
spec: null
7+
status:
8+
parents:
9+
- conditions:
10+
- lastTransitionTime: fake
11+
message: ""
12+
reason: Accepted
13+
status: "True"
14+
type: Accepted
15+
- lastTransitionTime: fake
16+
message: ""
17+
reason: ResolvedRefs
18+
status: "True"
19+
type: ResolvedRefs
20+
controllerName: kgateway.dev/agentgateway
21+
parentRef:
22+
group: gateway.networking.k8s.io
23+
kind: Gateway
24+
name: example-gateway
25+
namespace: default
26+
---
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Addresses:
2+
- service:
3+
hostname: example-svc.default.svc.cluster.local
4+
name: example-svc
5+
namespace: default
6+
ports:
7+
- servicePort: 8080
8+
Binds:
9+
- key: 80/default/example-gateway
10+
port: 80
11+
Listeners:
12+
- bindKey: 80/default/example-gateway
13+
gatewayName: default/example-gateway
14+
key: default/example-gateway.http
15+
name: http
16+
protocol: HTTP
17+
Routes:
18+
- backends:
19+
- backend:
20+
port: 8080
21+
service: default/example-svc.default.svc.cluster.local
22+
weight: 1
23+
hostnames:
24+
- example.com
25+
key: default/example-route.0.0.http
26+
listenerKey: default/example-gateway.http
27+
matches:
28+
- path:
29+
pathPrefix: /
30+
routeName: default/example-route
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: example-route
5+
namespace: default
6+
spec: null
7+
status:
8+
parents:
9+
- conditions:
10+
- lastTransitionTime: fake
11+
message: ""
12+
reason: Accepted
13+
status: "True"
14+
type: Accepted
15+
- lastTransitionTime: fake
16+
message: ""
17+
reason: ResolvedRefs
18+
status: "True"
19+
type: ResolvedRefs
20+
controllerName: kgateway.dev/agentgateway
21+
parentRef:
22+
group: gateway.networking.k8s.io
23+
kind: Gateway
24+
name: example-gateway
25+
namespace: default
26+
---
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Addresses:
2+
- service:
3+
hostname: example-svc.default.svc.cluster.local
4+
name: example-svc
5+
namespace: default
6+
ports:
7+
- servicePort: 8080
8+
Binds:
9+
- key: 80/default/example-gateway
10+
port: 80
11+
Listeners:
12+
- bindKey: 80/default/example-gateway
13+
gatewayName: default/example-gateway
14+
key: default/example-gateway.http
15+
name: http
16+
protocol: HTTP
17+
Routes:
18+
- backends:
19+
- backend:
20+
port: 8080
21+
service: default/example-svc.default.svc.cluster.local
22+
weight: 1
23+
hostnames:
24+
- example.com
25+
key: default/example-route.0.0.http
26+
listenerKey: default/example-gateway.http
27+
matches:
28+
- path:
29+
pathPrefix: /
30+
routeName: default/example-route

0 commit comments

Comments
 (0)