-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chart: Add ServiceAccount tests. (#12261)
Signed-off-by: Aran Shavit <[email protected]>
- Loading branch information
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
charts/ingress-nginx/tests/controller-serviceaccount_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
suite: Controller > ServiceAccount | ||
templates: | ||
- controller-serviceaccount.yaml | ||
|
||
tests: | ||
- it: should not create a ServiceAccount if `serviceAccount.create` is false | ||
set: | ||
serviceAccount.create: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: should create a ServiceAccount if `serviceAccount.create` is true | ||
set: | ||
serviceAccount.create: true | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: metadata.name | ||
value: RELEASE-NAME-ingress-nginx | ||
|
||
- it: should create a ServiceAccount with specified name if `serviceAccount.name` is set | ||
set: | ||
serviceAccount.name: ingress-nginx-admission-test-sa | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: metadata.name | ||
value: ingress-nginx-admission-test-sa | ||
|
||
- it: should create a ServiceAccount with token auto-mounting disabled if `serviceAccount.automountServiceAccountToken` is false | ||
set: | ||
serviceAccount.automountServiceAccountToken: false | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: automountServiceAccountToken | ||
value: false |
51 changes: 51 additions & 0 deletions
51
charts/ingress-nginx/tests/default-backend-serviceaccount_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
suite: Default Backend > ServiceAccount | ||
templates: | ||
- default-backend-serviceaccount.yaml | ||
|
||
tests: | ||
- it: should not create a ServiceAccount if `defaultBackend.serviceAccount.create` is false | ||
set: | ||
defaultBackend.enabled: true | ||
defaultBackend.serviceAccount.create: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: should create a ServiceAccount if `defaultBackend.serviceAccount.create` is true | ||
set: | ||
defaultBackend.enabled: true | ||
defaultBackend.serviceAccount.create: true | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: metadata.name | ||
value: RELEASE-NAME-ingress-nginx-backend | ||
|
||
- it: should create a ServiceAccount with specified name if `defaultBackend.serviceAccount.name` is set | ||
set: | ||
defaultBackend.enabled: true | ||
defaultBackend.serviceAccount.name: ingress-nginx-admission-test-sa | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: metadata.name | ||
value: ingress-nginx-admission-test-sa | ||
|
||
- it: should create a ServiceAccount with token auto-mounting disabled if `defaultBackend.serviceAccount.automountServiceAccountToken` is false | ||
set: | ||
defaultBackend.enabled: true | ||
defaultBackend.serviceAccount.automountServiceAccountToken: false | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: ServiceAccount | ||
- equal: | ||
path: automountServiceAccountToken | ||
value: false |