Skip to content

Commit 2a3f19c

Browse files
authored
test: add tests for service template (#90)
Add more tests for service template Signed-off-by: Eugene Maslovich <[email protected]>
1 parent 4dc3e1d commit 2a3f19c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

valkey/tests/service_test.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,55 @@ suite: service configuration
22
templates:
33
- templates/service.yaml
44
tests:
5+
- it: should have correct default service type
6+
template: templates/service.yaml
7+
asserts:
8+
- isKind:
9+
of: Service
10+
- equal:
11+
path: spec.type
12+
value: ClusterIP
13+
- it: should be able to set custom clusterIP
14+
set:
15+
service.clusterIP: "10.0.0.1"
16+
template: templates/service.yaml
17+
asserts:
18+
- isKind:
19+
of: Service
20+
- equal:
21+
path: spec.clusterIP
22+
value: "10.0.0.1"
23+
- it: should have correct default ports
24+
template: templates/service.yaml
25+
asserts:
26+
- contains:
27+
path: spec.ports
28+
content:
29+
port: 6379
30+
targetPort: tcp
31+
protocol: TCP
32+
name: tcp
33+
- it: should be able to set custom nodePort
34+
set:
35+
service.type: "NodePort"
36+
service.nodePort: 30080
37+
template: templates/service.yaml
38+
asserts:
39+
- isKind:
40+
of: Service
41+
- equal:
42+
path: spec.ports[0].nodePort
43+
value: 30080
44+
- it: should be able to set custom appProtocol
45+
set:
46+
service.appProtocol: "my-protocol"
47+
template: templates/service.yaml
48+
asserts:
49+
- isKind:
50+
of: Service
51+
- equal:
52+
path: spec.ports[0].appProtocol
53+
value: "my-protocol"
554
- it: should be able to set custom loadBalancerClass
655
set:
756
service.loadBalancerClass: "custom-lb-class"
@@ -19,3 +68,11 @@ tests:
1968
of: Service
2069
- notExists:
2170
path: spec.loadBalancerClass
71+
- it: should have correct selector labels
72+
template: templates/service.yaml
73+
asserts:
74+
- isSubset:
75+
path: spec.selector
76+
content:
77+
app.kubernetes.io/instance: RELEASE-NAME
78+
app.kubernetes.io/name: valkey

0 commit comments

Comments
 (0)