Fix Broken test (#601)

This commit is contained in:
florianspk 2024-01-16 07:15:58 +01:00
parent 7071d71439
commit 1a094225be
2 changed files with 13 additions and 26 deletions

View file

@ -94,7 +94,7 @@ imagePullSecrets:
Storage Class
*/}}
{{- define "gitea.persistence.storageClass" -}}
{{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass }}
{{- $storageClass := .Values.persistence.storageClass | default .Values.global.storageClass }}
{{- if $storageClass }}
storageClassName: {{ $storageClass | quote }}
{{- end }}

View file

@ -7,46 +7,33 @@ release:
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
template: templates/gitea/pvc.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: ".*"
- equal:
path: "spec.storageClassName"
value: "my-storage-class"
- it: should set global.storageClass when persistence.storageClass is not defined
template: templates/gitea/deployment.yaml
template: templates/gitea/pvc.yaml
set:
persistence.storageClass: null
global.storageClass: "default-storage-class"
asserts:
- contains:
path: spec.template.spec.volumes[0].persistentVolumeClaim.storageClassName
content: "default-storage-class"
- equal:
path: spec.storageClassName
value: "default-storage-class"
- it: should set storageClassName when persistence.storageClass is defined and global.storageClass is defined
template: templates/gitea/deployment.yaml
template: templates/gitea/pvc.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"
- equal:
path: spec.storageClassName
value: "my-storage-class"