From 87adfbcb41743e43ea1f7f8d94b3d8aa2c804a61 Mon Sep 17 00:00:00 2001
From: Lukas Malte Monnerjahn <lukasmalte.monnerjahn@dataport.de>
Date: Tue, 25 Mar 2025 14:22:16 +0100
Subject: [PATCH 1/2] OZG-4880 fix helm unittest
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

neues Release von helm-unittest scheint die Chart.Version über das Ende des Testcases hinaus bis zum Ende der Suite beizubehalten
---
 src/test/helm/deployment_63_char_test.yaml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/test/helm/deployment_63_char_test.yaml b/src/test/helm/deployment_63_char_test.yaml
index 28fa4858c8..e4f54aa404 100644
--- a/src/test/helm/deployment_63_char_test.yaml
+++ b/src/test/helm/deployment_63_char_test.yaml
@@ -44,21 +44,21 @@ set:
   imagePullSecret: image-pull-secret
 
 tests:
+  - it: should not fail on .Release.Namespace length less than 63 characters
+    asserts:
+      - notFailedTemplate: { }
   - it: should fail on .Release.Namespace length longer than 63 characters
     release:
       namespace: test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890
     asserts:
       - failedTemplate:
           errorMessage: .Release.Namespace test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
-  - it: should not fail on .Release.Namespace length less than 63 characters
+  - it: should not fail on .Chart.Name-.Chart.Version length less than 63 characters
     asserts:
-      - notFailedTemplate: {}
+      - notFailedTemplate: { }
   - it: should fail on .Chart.Name-.Chart.Version length longer than 63 characters
     chart:
       version: 1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890
     asserts:
       - failedTemplate:
           errorMessage: .Chart.Name-.Chart.Version alfa-1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
-  - it: should not fail on .Chart.Name-.Chart.Version length less than 63 characters
-    asserts:
-      - notFailedTemplate: {}
-- 
GitLab


From 4fa7b8d784beacabfd77ca58c3d7b19418031754 Mon Sep 17 00:00:00 2001
From: Lukas Malte Monnerjahn <lukasmalte.monnerjahn@dataport.de>
Date: Tue, 25 Mar 2025 14:24:00 +0100
Subject: [PATCH 2/2] OZG-4880 helm env values maxFileSize and contentTypes for
 postfachNachrichtAttachment

---
 src/main/helm/templates/deployment.yaml       |  8 +++
 src/test/helm/deployment_upload_env_test.yaml | 72 +++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 src/test/helm/deployment_upload_env_test.yaml

diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml
index ca99396fb1..a0c14d08bd 100644
--- a/src/main/helm/templates/deployment.yaml
+++ b/src/main/helm/templates/deployment.yaml
@@ -100,6 +100,14 @@ spec:
         - name: ozgcloud_user-assistance_documentation_url
           value: {{ .Values.ozgcloud.user_assistance.documentation.url }}
         {{- end }}
+        {{- if (((.Values.ozgcloud).upload).maxFileSize).postfachNachrichtAttachment }}
+        - name: ozgcloud_upload_maxFileSize_postfachNachrichtAttachment
+          value: {{ .Values.ozgcloud.upload.maxFileSize.postfachNachrichtAttachment }}
+        {{- end }}
+        {{- if (((.Values.ozgcloud).upload).contentTypes).postfachNachrichtAttachment }}
+        - name: ozgcloud_upload_contentTypes_postfachNachrichtAttachment
+          value: {{ .Values.ozgcloud.upload.contentTypes.postfachNachrichtAttachment }}
+        {{- end }}
         {{- with include "app.getCustomList" . }}
 {{ . | indent 8 }}
         {{- end }}
diff --git a/src/test/helm/deployment_upload_env_test.yaml b/src/test/helm/deployment_upload_env_test.yaml
new file mode 100644
index 0000000000..b0791698b1
--- /dev/null
+++ b/src/test/helm/deployment_upload_env_test.yaml
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2025 Das Land Schleswig-Holstein vertreten durch den
+# Ministerpräsidenten des Landes Schleswig-Holstein
+# Staatskanzlei
+# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
+#
+# Lizenziert unter der EUPL, Version 1.2 oder - sobald
+# diese von der Europäischen Kommission genehmigt wurden -
+# Folgeversionen der EUPL ("Lizenz");
+# Sie dürfen dieses Werk ausschließlich gemäß
+# dieser Lizenz nutzen.
+# Eine Kopie der Lizenz finden Sie hier:
+#
+# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
+#
+# Sofern nicht durch anwendbare Rechtsvorschriften
+# gefordert oder in schriftlicher Form vereinbart, wird
+# die unter der Lizenz verbreitete Software "so wie sie
+# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
+# ausdrücklich oder stillschweigend - verbreitet.
+# Die sprachspezifischen Genehmigungen und Beschränkungen
+# unter der Lizenz sind dem Lizenztext zu entnehmen.
+#
+
+suite: deployment upload env
+release:
+  name: alfa
+  namespace: sh-helm-test
+templates:
+  - templates/deployment.yaml
+set:
+  baseUrl: test.company.local
+  ozgcloud:
+    environment: test
+    bundesland: sh
+    bezeichner: helm
+    barrierefreiheitUrl: http://barrierefreiheit.test.url
+  sso:
+    serverUrl: https://sso.company.local
+  imagePullSecret: image-pull-secret
+tests:
+  - it: should set upload values
+    set:
+      ozgcloud:
+        upload:
+          maxFileSize:
+            postfachNachrichtAttachment: "50MB"
+          contentTypes:
+            postfachNachrichtAttachment: "text/plain,application/pdf"
+    asserts:
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: ozgcloud_upload_maxFileSize_postfachNachrichtAttachment
+            value: "50MB"
+      - contains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: ozgcloud_upload_contentTypes_postfachNachrichtAttachment
+            value: "text/plain,application/pdf"
+  - it: should not set upload values when missing
+    asserts:
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: ozgcloud_upload_maxFileSize_postfachNachrichtAttachment
+          any: true
+      - notContains:
+          path: spec.template.spec.containers[0].env
+          content:
+            name: ozgcloud_upload_contentTypes_postfachNachrichtAttachment
+          any: true
\ No newline at end of file
-- 
GitLab