Files
chart/library/common-test/tests/pod/volume_emptyDir_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

141 lines
3.6 KiB
YAML

suite: pod emptyDir volume test
templates:
- common.yaml
tests:
- it: should pass with emptyDir volume
set:
some_medium: Memory
some_size: 2Gi
workload:
workload-name1:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
emptyDir-vol:
enabled: true
type: emptyDir
medium: "{{ .Values.some_medium }}"
size: "{{ .Values.some_size }}"
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
contains:
path: spec.template.spec.volumes
content:
name: emptyDir-vol
emptyDir:
medium: Memory
sizeLimit: 2Gi
- it: should pass with emptyDir volume bare bones
set:
workload:
workload-name1:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
emptyDir-vol:
enabled: true
type: emptyDir
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
contains:
path: spec.template.spec.volumes
content:
name: emptyDir-vol
emptyDir: {}
- it: should pass with emptyDir volume with medium set
set:
workload:
workload-name1:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
emptyDir-vol:
enabled: true
type: emptyDir
medium: Memory
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
contains:
path: spec.template.spec.volumes
content:
name: emptyDir-vol
emptyDir:
medium: Memory
- it: should pass with emptyDir volume with size set
set:
workload:
workload-name1:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
emptyDir-vol:
enabled: true
type: emptyDir
size: 3Gi
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
contains:
path: spec.template.spec.volumes
content:
name: emptyDir-vol
emptyDir:
sizeLimit: 3Gi
# Failures
- it: should fail with invalid medium in emptyDir
set:
workload:
some-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
volume1:
enabled: true
type: emptyDir
medium: not-a-valid-medium
asserts:
- failedTemplate:
errorMessage: Persistence - Expected [medium] to be one of ["", Memory], but got [not-a-valid-medium] on <emptyDir> type
- it: should fail with invalid size format
set:
workload:
some-workload:
enabled: true
primary: true
type: Deployment
podSpec: {}
persistence:
volume1:
enabled: true
type: emptyDir
size: not-a-valid-size
asserts:
- failedTemplate:
errorMessage: Persistence Expected <size> to have one of the following formats [(Suffixed with E/P/T/G/M/K - eg. 1G), (Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi), (Plain Integer in bytes - eg. 1024), (Exponent - eg. 134e6)], but got [not-a-valid-size]