Files
chart/library/common-test/tests/persistence/validation_test.yaml
Stavros Kois da114013c1 NAS-121398 / 23.10 / Adds validation in few places (#1097)
* Adds a check in persistence that the specified configmap/secret exists

* catch edge case in env rendering

* validate size in emptyDir
2023-04-11 18:37:22 +03:00

93 lines
2.4 KiB
YAML

suite: persistence validation test
templates:
- common.yaml
tests:
- it: should fail with pod targetSelector not a map
set:
workload:
main:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
volume1:
enabled: true
targetSelector: not-a-map
asserts:
- failedTemplate:
errorMessage: Persistence - Expected <targetSelector> to be [dict], but got [string]
- it: should fail with invalid type
set:
workload:
main:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
volume1:
enabled: true
type: not-a-type
asserts:
- failedTemplate:
errorMessage: Persistence - Expected <type> to be one of [emptyDir, hostPath, ixVolume, secret, configmap, device], but got [not-a-type]
- it: should fail with non-existent configmap
set:
configmap:
my-configmap:
enabled: true
data:
foo: bar
persistence:
volume1:
enabled: true
type: configmap
mountPath: /mnt/volume1
objectName: my-non-existent-configmap
image: &image
repository: nginx
tag: 1.17.6
pullPolicy: IfNotPresent
workload: &workload
main:
enabled: true
primary: true
type: Deployment
podSpec:
containers:
main:
enabled: true
primary: true
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false
asserts:
- failedTemplate:
errorMessage: Persistence - Expected configmap [my-non-existent-configmap] defined in <objectName> to exist
- it: should fail with non-existent secret
set:
secret:
my-secret:
enabled: true
data:
foo: bar
persistence:
volume1:
enabled: true
type: secret
mountPath: /mnt/volume1
objectName: my-non-existent-secret
image: *image
workload: *workload
asserts:
- failedTemplate:
errorMessage: Persistence - Expected secret [my-non-existent-secret] defined in <objectName> to exist