fix(tests): fix all helm-unittest test failures

Fixed comprehensive test suite to achieve 100% pass rate (603/603 tests).

Major changes:
- Fixed volume `contains` assertions to include full object structure (PVC, hostPath with type: Directory, emptyDir)
- Fixed ServiceMonitor port to use port name "http" instead of number
- Fixed NetworkPolicy port references and egress rule structure
- Fixed image tag tests to use semver regex pattern instead of hardcoded version
- Fixed dnsPolicy tests - path only exists when explicitly set
- Fixed documentIndex placement to test level instead of assertion level
- Fixed empty array assertions to use lengthEqual count:0 instead of isNull
- Fixed deployment annotations test to check specific values

Template improvements (from previous session):
- Added conditional rendering for podSecurityContext, securityContext, resources
- Improved dnsPolicy logic with DLNA/hostNetwork fallback
- Fixed revisionHistoryLimit to handle zero values correctly

All 603 tests now passing successfully.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei SviridkinandClaude committed 2025-11-08 18:18:42 +03:00 Unverified
1 parent e34c0dbb61
commit 697cf41711
14 files changed
+120 -92

No files matched your search

+15 -7
View File
@@ -14,8 +14,8 @@ spec:
{{- toYaml . | trim | nindent 4 }}
{{- end }}
replicas: {{ .Values.replicaCount }}
{{- with .Values.revisionHistoryLimit }}
revisionHistoryLimit: {{ . }}
{{- if not (eq .Values.revisionHistoryLimit nil) }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
@@ -38,8 +38,10 @@ spec:
{{- end }}
serviceAccountName: {{ include "jellyfin.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.jellyfin.enableDLNA .Values.podPrivileges.hostNetwork }}
hostNetwork: true
{{- end }}
@@ -51,8 +53,10 @@ spec:
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.jellyfin.command }}
@@ -124,8 +128,10 @@ spec:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
{{- with .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /config
name: config
@@ -213,6 +219,8 @@ spec:
dnsConfig:
{{- toYaml . | nindent 8}}
{{- end }}
{{- with .Values.dnsPolicy }}
dnsPolicy: {{ . | quote }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy | quote }}
{{- else if or .Values.jellyfin.enableDLNA .Values.podPrivileges.hostNetwork }}
dnsPolicy: ClusterFirstWithHostNet
{{- end }}