helm-charts/charts/library/common-test/tests/pvc/datasource_test.yaml
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 0eac5ba7d7
feat(common): Release v2.3.0 (#228)
Signed-off-by: Christopher Larivière <lariviere.c@gmail.com>
Co-authored-by: Christopher Larivière <lariviere.c@gmail.com>
2023-11-20 19:33:30 +00:00

111 lines
3.3 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pvc datasource
templates:
- common.yaml
tests:
- it: default should pass
set:
persistence.config.enabled: true
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSource
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSourceRef
- it: with dataSource should pass
set:
persistence.config:
enabled: true
dataSource:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: MySnapshot
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: spec.dataSource
value:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: MySnapshot
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSourceRef
- it: templated dataSource name should pass
set:
persistence.config:
enabled: true
dataSource:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: "{{ .Release.Name }}-config"
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: spec.dataSource
value:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: RELEASE-NAME-config
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSourceRef
- it: with dataSourceRef should pass
set:
persistence.config:
enabled: true
dataSourceRef:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: MySnapshot
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: spec.dataSourceRef
value:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: MySnapshot
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSource
- it: templated dataSourceRef name should pass
set:
persistence.config:
enabled: true
dataSourceRef:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: "{{ .Release.Name }}-config"
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: spec.dataSourceRef
value:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: RELEASE-NAME-config
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: spec.dataSource