Skip to content

Commit 1b8bf04

Browse files
committed
add httproute tests to all relevant charts, fixed problems in templates
1 parent ef26d18 commit 1b8bf04

File tree

36 files changed

+1315
-3
lines changed

36 files changed

+1315
-3
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
suite: test httproute
2+
templates:
3+
- httproute.yaml
4+
chart:
5+
version: 0.9.8
6+
appVersion: 1.2.3
7+
tests:
8+
- it: should not create httproute by default
9+
asserts:
10+
- hasDocuments:
11+
count: 0
12+
13+
- it: should create httproute with values
14+
release:
15+
name: values-test-release
16+
values:
17+
- ./values/httproute.yaml
18+
asserts:
19+
- hasDocuments:
20+
count: 1
21+
- containsDocument:
22+
kind: HTTPRoute
23+
apiVersion: gateway.networking.k8s.io/v1
24+
name: values-test-release-o-neko-catnip
25+
- equal:
26+
path: metadata
27+
value:
28+
name: values-test-release-o-neko-catnip
29+
labels:
30+
helm.sh/chart: o-neko-catnip-0.9.8
31+
app.kubernetes.io/name: o-neko-catnip
32+
app.kubernetes.io/version: 1.2.3
33+
app.kubernetes.io/instance: values-test-release
34+
app.kubernetes.io/managed-by: Helm
35+
annotations:
36+
example.com/test: "simple"
37+
example.com/text: some text value
38+
- equal:
39+
path: spec
40+
value:
41+
parentRefs:
42+
- name: my-gateway
43+
namespace: gateway-namespace
44+
hostnames:
45+
- my-service.example.com
46+
- other.example.com
47+
rules:
48+
- backendRefs:
49+
- name: values-test-release-o-neko-catnip
50+
port: 8080
51+
filters:
52+
- type: RequestHeaderModifier
53+
requestHeaderModifier:
54+
set:
55+
- name: X-Custom-Header
56+
value: custom-value
57+
matches:
58+
- path:
59+
type: PathPrefix
60+
value: /
61+
- notFailedTemplate: {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
httpRoute:
2+
enabled: true
3+
parentRefs:
4+
- name: my-gateway
5+
namespace: gateway-namespace
6+
hostnames:
7+
- my-service.example.com
8+
- other.example.com
9+
matches:
10+
- path:
11+
type: PathPrefix
12+
value: /
13+
filters:
14+
- type: RequestHeaderModifier
15+
requestHeaderModifier:
16+
set:
17+
- name: X-Custom-Header
18+
value: custom-value
19+
annotations:
20+
example.com/test: simple
21+
example.com/text: some text value
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
suite: test httproute
2+
templates:
3+
- httproute.yaml
4+
chart:
5+
version: 0.9.8
6+
appVersion: 1.2.3
7+
tests:
8+
- it: should not create httproute by default
9+
asserts:
10+
- hasDocuments:
11+
count: 0
12+
13+
- it: should create httproute with values
14+
release:
15+
name: values-test-release
16+
values:
17+
- ./values/httproute.yaml
18+
asserts:
19+
- hasDocuments:
20+
count: 1
21+
- containsDocument:
22+
kind: HTTPRoute
23+
apiVersion: gateway.networking.k8s.io/v1
24+
name: values-test-release-o-neko
25+
- equal:
26+
path: metadata
27+
value:
28+
name: values-test-release-o-neko
29+
labels:
30+
helm.sh/chart: o-neko-0.9.8
31+
app.kubernetes.io/name: o-neko
32+
app.kubernetes.io/version: 1.2.3
33+
app.kubernetes.io/instance: values-test-release
34+
app.kubernetes.io/managed-by: Helm
35+
annotations:
36+
example.com/test: "simple"
37+
example.com/text: some text value
38+
- equal:
39+
path: spec
40+
value:
41+
parentRefs:
42+
- name: my-gateway
43+
namespace: gateway-namespace
44+
hostnames:
45+
- my-service.example.com
46+
- other.example.com
47+
rules:
48+
- backendRefs:
49+
- name: values-test-release-o-neko
50+
port: 8080
51+
filters:
52+
- type: RequestHeaderModifier
53+
requestHeaderModifier:
54+
set:
55+
- name: X-Custom-Header
56+
value: custom-value
57+
matches:
58+
- path:
59+
type: PathPrefix
60+
value: /
61+
- notFailedTemplate: {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
httpRoute:
2+
enabled: true
3+
parentRefs:
4+
- name: my-gateway
5+
namespace: gateway-namespace
6+
hostnames:
7+
- my-service.example.com
8+
- other.example.com
9+
matches:
10+
- path:
11+
type: PathPrefix
12+
value: /
13+
filters:
14+
- type: RequestHeaderModifier
15+
requestHeaderModifier:
16+
set:
17+
- name: X-Custom-Header
18+
value: custom-value
19+
annotations:
20+
example.com/test: simple
21+
example.com/text: some text value
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
suite: test httproute
2+
templates:
3+
- httproute.yaml
4+
chart:
5+
version: 0.9.8
6+
tests:
7+
- it: should not create httproute by default
8+
asserts:
9+
- hasDocuments:
10+
count: 0
11+
12+
- it: should create httproute with values
13+
release:
14+
name: values-test-release
15+
values:
16+
- ./values/httproute.yaml
17+
asserts:
18+
- hasDocuments:
19+
count: 1
20+
- containsDocument:
21+
kind: HTTPRoute
22+
apiVersion: gateway.networking.k8s.io/v1
23+
name: values-test-release-sophora-admin-dashboard
24+
- equal:
25+
path: metadata
26+
value:
27+
name: values-test-release-sophora-admin-dashboard
28+
labels:
29+
helm.sh/chart: sophora-admin-dashboard-0.9.8
30+
app.kubernetes.io/name: sophora-admin-dashboard
31+
app.kubernetes.io/instance: values-test-release
32+
app.kubernetes.io/managed-by: Helm
33+
annotations:
34+
example.com/test: "simple"
35+
example.com/text: some text value
36+
- equal:
37+
path: spec
38+
value:
39+
parentRefs:
40+
- name: my-gateway
41+
namespace: gateway-namespace
42+
hostnames:
43+
- my-service.example.com
44+
- other.example.com
45+
rules:
46+
- backendRefs:
47+
- name: values-test-release-sophora-admin-dashboard
48+
port: 80
49+
filters:
50+
- type: RequestHeaderModifier
51+
requestHeaderModifier:
52+
set:
53+
- name: X-Custom-Header
54+
value: custom-value
55+
matches:
56+
- path:
57+
type: PathPrefix
58+
value: /
59+
- notFailedTemplate: {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
httpRoute:
2+
enabled: true
3+
parentRefs:
4+
- name: my-gateway
5+
namespace: gateway-namespace
6+
hostnames:
7+
- my-service.example.com
8+
- other.example.com
9+
matches:
10+
- path:
11+
type: PathPrefix
12+
value: /
13+
filters:
14+
- type: RequestHeaderModifier
15+
requestHeaderModifier:
16+
set:
17+
- name: X-Custom-Header
18+
value: custom-value
19+
annotations:
20+
example.com/test: simple
21+
example.com/text: some text value
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
suite: test httproute
2+
templates:
3+
- httproute.yaml
4+
chart:
5+
version: 0.9.8
6+
appVersion: 1.2.3
7+
tests:
8+
- it: should not create httproute by default
9+
asserts:
10+
- hasDocuments:
11+
count: 0
12+
13+
- it: should create httproute with values
14+
release:
15+
name: values-test-release
16+
values:
17+
- ./values/httproute.yaml
18+
asserts:
19+
- hasDocuments:
20+
count: 1
21+
- containsDocument:
22+
kind: HTTPRoute
23+
apiVersion: gateway.networking.k8s.io/v1
24+
name: values-test-release-sophora-ai
25+
- equal:
26+
path: metadata
27+
value:
28+
name: values-test-release-sophora-ai
29+
labels:
30+
helm.sh/chart: sophora-ai-0.9.8
31+
app.kubernetes.io/name: sophora-ai
32+
app.kubernetes.io/version: 1.2.3
33+
app.kubernetes.io/instance: values-test-release
34+
app.kubernetes.io/managed-by: Helm
35+
annotations:
36+
example.com/test: "simple"
37+
example.com/text: some text value
38+
- equal:
39+
path: spec
40+
value:
41+
parentRefs:
42+
- name: my-gateway
43+
namespace: gateway-namespace
44+
hostnames:
45+
- my-service.example.com
46+
- other.example.com
47+
rules:
48+
- backendRefs:
49+
- name: values-test-release-sophora-ai
50+
port: 8080
51+
filters:
52+
- type: RequestHeaderModifier
53+
requestHeaderModifier:
54+
set:
55+
- name: X-Custom-Header
56+
value: custom-value
57+
matches:
58+
- path:
59+
type: PathPrefix
60+
value: /
61+
- notFailedTemplate: {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
httpRoute:
2+
enabled: true
3+
parentRefs:
4+
- name: my-gateway
5+
namespace: gateway-namespace
6+
hostnames:
7+
- my-service.example.com
8+
- other.example.com
9+
matches:
10+
- path:
11+
type: PathPrefix
12+
value: /
13+
filters:
14+
- type: RequestHeaderModifier
15+
requestHeaderModifier:
16+
set:
17+
- name: X-Custom-Header
18+
value: custom-value
19+
annotations:
20+
example.com/test: simple
21+
example.com/text: some text value

charts/sophora-contentapi/tests/httproute_test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ templates:
33
- httproute.yaml
44
chart:
55
version: 0.9.8
6+
appVersion: 1.2.3
67
tests:
78
- it: should not create httproute by default
89
asserts:
@@ -28,7 +29,7 @@ tests:
2829
labels:
2930
helm.sh/chart: sophora-contentapi-0.9.8
3031
app.kubernetes.io/name: sophora-contentapi
31-
app.kubernetes.io/version: 6.0.0
32+
app.kubernetes.io/version: 1.2.3
3233
app.kubernetes.io/instance: values-test-release
3334
app.kubernetes.io/managed-by: Helm
3435
annotations:

0 commit comments

Comments
 (0)