From e0ce284d5a78ce98b6ed9b89441e89192512ab90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Fri, 17 Dec 2021 14:05:29 +0100
Subject: [PATCH] Test chart in CI job

---
 .gitlab-ci.yml                                               | 1 +
 ...{test-connection.yaml => test-prometheus-connection.yaml} | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
 rename helm/templates/tests/{test-connection.yaml => test-prometheus-connection.yaml} (73%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 18e48f078..bee455a79 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -84,6 +84,7 @@ test-helm:
     - cd helm
     - helm dependencies update .
     - helm install theodolite . -f preconfigs/minimal.yaml --wait
+    - helm test theodolite
     - kubectl get nodes -o wide
     - kubectl get pods --all-namespaces -o wide
     - kubectl get services --all-namespaces -o wide
diff --git a/helm/templates/tests/test-connection.yaml b/helm/templates/tests/test-prometheus-connection.yaml
similarity index 73%
rename from helm/templates/tests/test-connection.yaml
rename to helm/templates/tests/test-prometheus-connection.yaml
index 7af87e989..313a0825a 100644
--- a/helm/templates/tests/test-connection.yaml
+++ b/helm/templates/tests/test-prometheus-connection.yaml
@@ -1,3 +1,4 @@
+{{- if .Values.prometheus.enabled }}
 apiVersion: v1
 kind: Pod
 metadata:
@@ -5,7 +6,8 @@ metadata:
   labels:
     {{- include "theodolite.labels" . | nindent 4 }}
   annotations:
-    "helm.sh/hook": test-success
+    "helm.sh/hook": test
+    "helm.sh/hook-delete-policy": hook-succeeded
 spec:
   containers:
     - name: wget
@@ -13,3 +15,4 @@ spec:
       command: ['wget']
       args: ['http://prometheus-operated:9090']
   restartPolicy: Never
+{{- end }}
-- 
GitLab