{{- if .Values.testFramework.enabled -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-test namespace: {{ .Release.Namespace }} labels: type: helm-chart-test {{- include "perses.labels" . | nindent 4 }} annotations: "helm.sh/hook": test "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded" data: run.sh: |- #!/usr/bin/env bats load "/usr/lib/bats/bats-detik/utils" load "/usr/lib/bats/bats-detik/detik" DETIK_CLIENT_NAME="kubectl" @test "Verify that there is a service named {{ include "perses.fullname" . }}" { verify "there is 1 service named '^{{ include "perses.fullname" . }}$'" } @test "Verify that there is a configmap named {{ include "perses.fullname" . }}" { verify "there is 1 configmap named '^{{ include "perses.fullname" . }}$'" } {{- if .Values.config.database.file }} @test "Verify successful statefulset and running status of the {{ .Release.Name }} pod" { verify "there is 1 statefulset named '{{ include "perses.fullname" . }}'" try "at most 3 times every 20s to get pods named '{{ include "perses.fullname" . }}.*' and verify that '.status.phase' is 'running'" } {{- end -}} {{- if .Values.config.database.sql }} @test "Verify successful deployment and running status of the {{ .Release.Name }} pod" { verify "there is 1 deployment named '{{ include "perses.fullname" . }}'" try "at most 3 times every 20s to get pods named '{{ include "perses.fullname" . }}.*' and verify that '.status.phase' is 'running'" } {{- end -}} {{- if .Values.persistence.enabled }} @test "Verify successful creation and bound status of {{ include "perses.fullname" . }} persistent volume claims" { try "at most 3 times every 5s to get persistentvolumeclaims named '{{ include "perses.fullname" . }}.*' and verify that '.status.phase' is 'Bound'" } {{- end -}} {{- if .Values.ingress.enabled }} @test "Verify successful creation of ingress resource" { verify "there is 1 ingress named '^{{ include "perses.fullname" . }}$'" } {{- end -}} {{- if and .Values.gateway.enabled .Values.gateway.createGateway }} @test "Verify successful creation of gateway resource" { verify "there is 1 gateways.gateway.networking.k8s.io named '^{{ default (printf "%s-gateway" (include "perses.fullname" .)) .Values.gateway.name }}$'" } {{- end -}} {{- if .Values.gateway.enabled }} @test "Verify successful creation of HTTPRoute resource" { verify "there is 1 httproutes.gateway.networking.k8s.io named '^{{ default (printf "%s-http-route" (include "perses.fullname" .)) .Values.gateway.httpRoute.name }}$'" } {{- end -}} {{ if .Values.serviceMonitor.selfMonitor }} @test "Verify succesful creation of ServiceMonitor" { verify "there is 1 servicemonitor named '^{{ include "perses.fullname" . }}$'" } {{ end }} {{- end -}}