apiVersion: v1
kind: Pod
metadata:
  name: "{{ .Release.Name }}-startup-test"
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: {{ .Release.Name }}-startup-test
      image: r0zbot/rocketchat-test-utils
      imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
      {{- if .Values.securityContext.enabled }}
      securityContext:
        runAsUser: {{ .Values.securityContext.runAsUser }}
      {{- end }}
      env:
        - name: ROCKETCHAT_HOST
          value: http://{{ template "rocketchat.fullname" . }}.{{ .Release.Namespace }}
      command:
        - /bin/bash
        - -ec
        - echo "testing host $ROCKETCHAT_HOST" && ./wait_http.sh "$ROCKETCHAT_HOST" && ./basic_test.sh "$ROCKETCHAT_HOST"
  restartPolicy: Never