more tests

This commit is contained in:
Stavros kois
2023-01-18 16:05:33 +02:00
parent 6c7a33ce1c
commit 0bb7100cbf
3 changed files with 123 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
suite: daemonset generic test
templates:
- common.yaml
tests:
- it: should pass with controller set to DaemonSet
documentIndex: &daemonsetDoc 0
set:
controller.type: DaemonSet
asserts:
- hasDocuments:
count: 3
- isKind:
of: DaemonSet
- isAPIVersion:
of: apps/v1
- it: should pass with podSecurityContext changed
documentIndex: *daemonsetDoc
set:
controller.type: DaemonSet
podSecurityContext:
fsGroup: 0
fsGroupChangePolicy: Always
supplementalGroups:
- 1000
asserts:
- equal:
path: spec.template.spec.securityContext
value:
fsGroup: 0
fsGroupChangePolicy: Always
supplementalGroups:
- 1000
- it: should pass with podSecurityContext changed
documentIndex: *daemonsetDoc
set:
controller.type: DaemonSet
securityContext:
runAsUser: 1000
runAsGroup: 1000
capabilities:
add:
- something
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext
value:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
capabilities:
add:
- something
drop:
- ALL

View File

@@ -8,7 +8,7 @@ tests:
- hasDocuments:
count: 3
- isKind:
of: StatefulSet
of: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-common-test

View File

@@ -0,0 +1,61 @@
suite: statefulset generic test
templates:
- common.yaml
tests:
- it: should pass with controller set to StatefulSet
documentIndex: &statefulsetDoc 0
set:
controller.type: StatefulSet
asserts:
- hasDocuments:
count: 3
- isKind:
of: StatefulSet
- isAPIVersion:
of: apps/v1
- it: should pass with podSecurityContext changed
documentIndex: *statefulsetDoc
set:
controller.type: StatefulSet
podSecurityContext:
fsGroup: 0
fsGroupChangePolicy: Always
supplementalGroups:
- 1000
asserts:
- equal:
path: spec.template.spec.securityContext
value:
fsGroup: 0
fsGroupChangePolicy: Always
supplementalGroups:
- 1000
- it: should pass with podSecurityContext changed
documentIndex: *statefulsetDoc
set:
controller.type: StatefulSet
securityContext:
runAsUser: 1000
runAsGroup: 1000
capabilities:
add:
- something
asserts:
- equal:
path: spec.template.spec.containers[0].securityContext
value:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
capabilities:
add:
- something
drop:
- ALL