helm-charts/charts/library/common-test/tests/pvc/metadata_test.yaml
2024-03-15 08:33:07 +00:00

110 lines
3.3 KiB
YAML

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: pvc metadata
templates:
- common.yaml
values:
- ../_values/controllers_main_default_container.yaml
set:
persistence.config:
accessMode: ReadWriteOnce
size: 1Gi
tests:
- it: default should pass
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
notExists:
path: metadata.annotations
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: retain enabled should pass
set:
persistence.config:
retain: true
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.annotations
value:
helm.sh/resource-policy: keep
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
- it: custom metadata should pass
set:
persistence.config:
labels:
test_label: test
annotations:
test_annotation: test
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.annotations
value:
test_annotation: test
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
helm.sh/chart: common-test-1.0.0
test_label: test
- it: custom metadata with global metadata should pass
set:
global:
labels:
global_label: test
annotations:
global_annotation: test
persistence.config:
labels:
test_label: test
annotations:
test_annotation: test
asserts:
- documentIndex: &PersistentVolumeClaimDocument 0
isKind:
of: PersistentVolumeClaim
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.annotations
value:
test_annotation: test
global_annotation: test
- documentIndex: *PersistentVolumeClaimDocument
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: RELEASE-NAME
global_label: test
helm.sh/chart: common-test-1.0.0
test_label: test