Skip to content

Commit 8d25e3b

Browse files
committed
feat: update helm unittest to v1.0.3
- update unittest helm plugin - update tests to comply with updated syntax Signed-off-by: Jernej Porenta <jernej.porenta@3fs.si>
1 parent 1af20ed commit 8d25e3b

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ _latest:
2727
fi
2828

2929
_helm-unittest:
30-
helm plugin ls | grep unittest || helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.8.2
30+
helm plugin ls | grep unittest || helm plugin install https://github.com/helm-unittest/helm-unittest --version v1.0.3
3131

3232
# golang linter
3333
lint-go:

test/lint/images.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ tests:
1010
errorMessage: |
1111
values don't meet the specifications of the schema(s) in the following chart(s):
1212
opa-kube-mgmt:
13-
- (root): image is required
13+
- at '': missing property 'image'
14+
1415
- it: image.repository not string
1516
set:
1617
image:
@@ -20,7 +21,8 @@ tests:
2021
errorMessage: |
2122
values don't meet the specifications of the schema(s) in the following chart(s):
2223
opa-kube-mgmt:
23-
- image.repository: Invalid type. Expected: string, given: integer
24+
- at '/image/repository': got number, want string
25+
2426
- it: image.tag not string
2527
set:
2628
image:
@@ -30,7 +32,8 @@ tests:
3032
errorMessage: |
3133
values don't meet the specifications of the schema(s) in the following chart(s):
3234
opa-kube-mgmt:
33-
- image.tag: Invalid type. Expected: string, given: integer
35+
- at '/image/tag': got number, want string
36+
3437
- it: mgmt.image is null
3538
set:
3639
mgmt:
@@ -40,7 +43,8 @@ tests:
4043
errorMessage: |
4144
values don't meet the specifications of the schema(s) in the following chart(s):
4245
opa-kube-mgmt:
43-
- mgmt: image is required
46+
- at '/mgmt': missing property 'image'
47+
4448
- it: mgmt.image.repository not string
4549
set:
4650
mgmt:
@@ -51,7 +55,8 @@ tests:
5155
errorMessage: |
5256
values don't meet the specifications of the schema(s) in the following chart(s):
5357
opa-kube-mgmt:
54-
- mgmt.image.repository: Invalid type. Expected: string, given: integer
58+
- at '/mgmt/image/repository': got number, want string
59+
5560
- it: mgmt.image.tag not string
5661
set:
5762
mgmt:
@@ -62,4 +67,4 @@ tests:
6267
errorMessage: |
6368
values don't meet the specifications of the schema(s) in the following chart(s):
6469
opa-kube-mgmt:
65-
- mgmt.image.tag: Invalid type. Expected: string, given: integer
70+
- at '/mgmt/image/tag': got number, want string

test/lint/sa.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ tests:
99
foo: 1
1010
asserts:
1111
- failedTemplate:
12-
errorMessage: |
13-
values don't meet the specifications of the schema(s) in the following chart(s):
14-
opa-kube-mgmt:
15-
- serviceAccount.annotations.foo: Invalid type. Expected: string, given: integer
12+
errorPattern: "got number, want string"

test/lint/service.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,34 @@ suite: lint service
22
templates:
33
- service.yaml
44
tests:
5-
- it: service annotations must be a string for foo
5+
- it: fails when service annotation is boolean
66
set:
77
service:
88
annotations:
99
bar: true
10+
asserts:
11+
- failedTemplate:
12+
errorPattern: "got boolean, want string"
13+
14+
- it: fails when service annotation is array
15+
set:
16+
service:
17+
annotations:
1018
baz: ["invalid"]
19+
asserts:
20+
- failedTemplate:
21+
errorPattern: "got array, want string"
22+
23+
- it: fails when service annotation is object
24+
set:
25+
service:
26+
annotations:
1127
foo:
1228
bar: baz
1329
asserts:
1430
- failedTemplate:
15-
errorPattern: "Invalid type. Expected: string, given"
31+
errorPattern: "got object, want string"
32+
1633
- it: trafficDistribution invalid value
1734
set:
1835
service:
@@ -22,4 +39,4 @@ tests:
2239
errorMessage: |
2340
values don't meet the specifications of the schema(s) in the following chart(s):
2441
opa-kube-mgmt:
25-
- service.trafficDistribution: service.trafficDistribution must be one of the following: "PreferClose", "PreferSameNode", "PreferSameZone", null
42+
- at '/service/trafficDistribution': value must be one of 'PreferClose', 'PreferSameNode', 'PreferSameZone', <nil>

0 commit comments

Comments
 (0)