{{- if .Values.tests.enabled }} apiVersion: v1 kind: Pod metadata: name: "{{ template "mariadb.fullname" . }}-test-{{ randAlphaNum 5 | lower }}" annotations: "helm.sh/hook": test-success spec: initContainers: - name: "test-framework" image: {{ template "mariadb.tests.testFramework.image" . }} command: - "bash" - "-c" - | set -ex # copy bats to tools dir cp -R /usr/local/libexec/ /tools/bats/ {{- if .Values.tests.testFramework.resources }} resources: {{ toYaml .Values.tests.testFramework.resources | nindent 8 }} {{- end }} volumeMounts: - mountPath: /tools name: tools containers: - name: mariadb-test image: {{ template "mariadb.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} command: ["/tools/bats/bats", "-t", "/tests/run.sh"] env: - name: MARIADB_ROOT_PASSWORD valueFrom: secretKeyRef: name: {{ template "mariadb.secretName" . }} key: mariadb-root-password {{- if .Values.tests.resources }} resources: {{ toYaml .Values.tests.resources | nindent 8 }} {{- end }} volumeMounts: - mountPath: /tests name: tests readOnly: true - mountPath: /tools name: tools volumes: - name: tests configMap: name: {{ template "mariadb.fullname" . }}-tests - name: tools emptyDir: {} restartPolicy: Never {{- end }}