Add unit tests (#601)

This commit is contained in:
florianspk 2024-01-15 22:11:18 +01:00
parent b91ea93fb3
commit 7071d71439

View file

@ -0,0 +1,52 @@
# File: tests/gitea-storageclass-tests.yaml
suite: storage class configuration tests
release:
name: gitea-storageclass-tests
namespace: testing
templates:
- templates/gitea/deployment.yaml
- templates/gitea/config.yaml
- templates/gitea/pvc.yaml
tests:
- it: should set storageClassName when persistence.storageClass is defined
template: templates/gitea/deployment.yaml
set:
persistence.storageClass: "my-storage-class"
asserts:
- contains:
path: spec.template.spec.volumes[0].persistentVolumeClaim.storageClassName
content: "my-storage-class"
- it: should not set storageClassName when persistence.storageClass is not defined
template: templates/gitea/deployment.yaml
set:
persistence.storageClass: null
asserts:
- notContains:
path: spec.template.spec.volumes[0].persistentVolumeClaim.storageClassName
any: true
content: ".*"
- it: should set global.storageClass when persistence.storageClass is not defined
template: templates/gitea/deployment.yaml
set:
persistence.storageClass: null
global.storageClass: "default-storage-class"
asserts:
- contains:
path: spec.template.spec.volumes[0].persistentVolumeClaim.storageClassName
content: "default-storage-class"
- it: should set storageClassName when persistence.storageClass is defined and global.storageClass is defined
template: templates/gitea/deployment.yaml
set:
global.storageClass: "default-storage-class"
persistence.storageClass: "my-storage-class"
asserts:
- contains:
path: spec.template.spec.volumes[0].persistentVolumeClaim.storageClassName
content: "my-storage-class"