Add helm-unittest tests for dedicated cache volume persistence: - Default emptyDir behavior - PVC creation when enabled - hostPath configuration - Volume mount verification - PVC size, access mode, storage class configuration - Annotations support - Existing claim usage - Type-specific behavior (pvc vs hostPath vs emptyDir) Add NOTES.txt with persistence information: - Show config, media, and cache volume types - Display cache volume details when enabled - Benefits explanation for cache volume - Warning for hostPath usage Tests ensure cache persistence works correctly for all scenarios. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
161 lines
4.4 KiB
YAML
161 lines
4.4 KiB
YAML
suite: test cache persistence
|
|
templates:
|
|
- deployment.yaml
|
|
- persistentVolumeClaim.yaml
|
|
tests:
|
|
# Deployment volume mount tests
|
|
- it: should mount cache as emptyDir by default
|
|
template: deployment.yaml
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: cache
|
|
emptyDir: {}
|
|
|
|
- it: should mount cache PVC when enabled
|
|
template: deployment.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: cache
|
|
persistentVolumeClaim:
|
|
claimName: RELEASE-NAME-jellyfin-cache
|
|
|
|
- it: should mount cache from hostPath when configured
|
|
template: deployment.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: hostPath
|
|
persistence.cache.hostPath: /mnt/jellyfin-cache
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: cache
|
|
hostPath:
|
|
path: /mnt/jellyfin-cache
|
|
|
|
- it: should mount cache at correct path
|
|
template: deployment.yaml
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
content:
|
|
name: cache
|
|
mountPath: /cache
|
|
|
|
# PVC tests
|
|
- it: should not create cache PVC by default
|
|
template: persistentVolumeClaim.yaml
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 2 # config and media only
|
|
|
|
- it: should create cache PVC when enabled
|
|
template: persistentVolumeClaim.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 3 # config, media, and cache
|
|
- contains:
|
|
path: metadata.name
|
|
content: RELEASE-NAME-jellyfin-cache
|
|
|
|
- it: should not create cache PVC when type is hostPath
|
|
template: persistentVolumeClaim.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: hostPath
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 2 # config and media only
|
|
|
|
- it: should not create cache PVC when type is emptyDir
|
|
template: persistentVolumeClaim.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: emptyDir
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 2
|
|
|
|
- it: should set cache PVC size correctly
|
|
template: persistentVolumeClaim.yaml
|
|
documentIndex: 2
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.size: 20Gi
|
|
asserts:
|
|
- equal:
|
|
path: spec.resources.requests.storage
|
|
value: 20Gi
|
|
|
|
- it: should set cache PVC access mode
|
|
template: persistentVolumeClaim.yaml
|
|
documentIndex: 2
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.accessMode: ReadWriteMany
|
|
asserts:
|
|
- contains:
|
|
path: spec.accessModes
|
|
content: ReadWriteMany
|
|
|
|
- it: should set cache PVC storage class
|
|
template: persistentVolumeClaim.yaml
|
|
documentIndex: 2
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.storageClass: fast-ssd
|
|
asserts:
|
|
- equal:
|
|
path: spec.storageClassName
|
|
value: fast-ssd
|
|
|
|
- it: should add annotations to cache PVC
|
|
template: persistentVolumeClaim.yaml
|
|
documentIndex: 2
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.annotations:
|
|
my-annotation: my-value
|
|
asserts:
|
|
- equal:
|
|
path: metadata.annotations.my-annotation
|
|
value: my-value
|
|
|
|
- it: should use existing claim when specified
|
|
template: deployment.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.existingClaim: my-existing-cache-claim
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: cache
|
|
persistentVolumeClaim:
|
|
claimName: my-existing-cache-claim
|
|
|
|
- it: should not create PVC when existing claim used
|
|
template: persistentVolumeClaim.yaml
|
|
set:
|
|
persistence.cache.enabled: true
|
|
persistence.cache.type: pvc
|
|
persistence.cache.existingClaim: my-existing-cache-claim
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 2 # config and media only, not cache
|