Skip to content

Commit b528c7e

Browse files
Chart: Add ServiceAccount tests. (#12266)
Signed-off-by: Aran Shavit <[email protected]> Co-authored-by: Aran Shavit <[email protected]>
1 parent 0a82e71 commit b528c7e

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
suite: Controller > ServiceAccount
2+
templates:
3+
- controller-serviceaccount.yaml
4+
5+
tests:
6+
- it: should not create a ServiceAccount if `serviceAccount.create` is false
7+
set:
8+
serviceAccount.create: false
9+
asserts:
10+
- hasDocuments:
11+
count: 0
12+
13+
- it: should create a ServiceAccount if `serviceAccount.create` is true
14+
set:
15+
serviceAccount.create: true
16+
asserts:
17+
- hasDocuments:
18+
count: 1
19+
- isKind:
20+
of: ServiceAccount
21+
- equal:
22+
path: metadata.name
23+
value: RELEASE-NAME-ingress-nginx
24+
25+
- it: should create a ServiceAccount with specified name if `serviceAccount.name` is set
26+
set:
27+
serviceAccount.name: ingress-nginx-admission-test-sa
28+
asserts:
29+
- hasDocuments:
30+
count: 1
31+
- isKind:
32+
of: ServiceAccount
33+
- equal:
34+
path: metadata.name
35+
value: ingress-nginx-admission-test-sa
36+
37+
- it: should create a ServiceAccount with token auto-mounting disabled if `serviceAccount.automountServiceAccountToken` is false
38+
set:
39+
serviceAccount.automountServiceAccountToken: false
40+
asserts:
41+
- hasDocuments:
42+
count: 1
43+
- isKind:
44+
of: ServiceAccount
45+
- equal:
46+
path: automountServiceAccountToken
47+
value: false
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
suite: Default Backend > ServiceAccount
2+
templates:
3+
- default-backend-serviceaccount.yaml
4+
5+
tests:
6+
- it: should not create a ServiceAccount if `defaultBackend.serviceAccount.create` is false
7+
set:
8+
defaultBackend.enabled: true
9+
defaultBackend.serviceAccount.create: false
10+
asserts:
11+
- hasDocuments:
12+
count: 0
13+
14+
- it: should create a ServiceAccount if `defaultBackend.serviceAccount.create` is true
15+
set:
16+
defaultBackend.enabled: true
17+
defaultBackend.serviceAccount.create: true
18+
asserts:
19+
- hasDocuments:
20+
count: 1
21+
- isKind:
22+
of: ServiceAccount
23+
- equal:
24+
path: metadata.name
25+
value: RELEASE-NAME-ingress-nginx-backend
26+
27+
- it: should create a ServiceAccount with specified name if `defaultBackend.serviceAccount.name` is set
28+
set:
29+
defaultBackend.enabled: true
30+
defaultBackend.serviceAccount.name: ingress-nginx-admission-test-sa
31+
asserts:
32+
- hasDocuments:
33+
count: 1
34+
- isKind:
35+
of: ServiceAccount
36+
- equal:
37+
path: metadata.name
38+
value: ingress-nginx-admission-test-sa
39+
40+
- it: should create a ServiceAccount with token auto-mounting disabled if `defaultBackend.serviceAccount.automountServiceAccountToken` is false
41+
set:
42+
defaultBackend.enabled: true
43+
defaultBackend.serviceAccount.automountServiceAccountToken: false
44+
asserts:
45+
- hasDocuments:
46+
count: 1
47+
- isKind:
48+
of: ServiceAccount
49+
- equal:
50+
path: automountServiceAccountToken
51+
value: false

0 commit comments

Comments
 (0)