jenkins-test.yaml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {{- if .Values.controller.testEnabled }}
  2. apiVersion: v1
  3. kind: Pod
  4. metadata:
  5. name: "{{ .Release.Name }}-ui-test-{{ randAlphaNum 5 | lower }}"
  6. namespace: {{ template "jenkins.namespace" . }}
  7. annotations:
  8. "helm.sh/hook": test-success
  9. spec:
  10. {{- if .Values.controller.nodeSelector }}
  11. nodeSelector:
  12. {{ toYaml .Values.controller.nodeSelector | indent 4 }}
  13. {{- end }}
  14. {{- if .Values.controller.tolerations }}
  15. tolerations:
  16. {{ toYaml .Values.controller.tolerations | indent 4 }}
  17. {{- end }}
  18. initContainers:
  19. - name: "test-framework"
  20. image: {{ .Values.helmtest.bats.image }}:{{ .Values.helmtest.bats.tag }}
  21. command:
  22. - "bash"
  23. - "-c"
  24. args:
  25. - |
  26. # copy bats to tools dir
  27. set -ex
  28. cp -R /opt/bats /tools/bats/
  29. volumeMounts:
  30. - mountPath: /tools
  31. name: tools
  32. containers:
  33. - name: {{ .Release.Name }}-ui-test
  34. image: "{{ .Values.controller.image }}:{{- include "controller.tag" . -}}"
  35. command: ["/tools/bats/bin/bats", "-t", "/tests/run.sh"]
  36. volumeMounts:
  37. - mountPath: /tests
  38. name: tests
  39. readOnly: true
  40. - mountPath: /tools
  41. name: tools
  42. volumes:
  43. - name: tests
  44. configMap:
  45. name: {{ template "jenkins.fullname" . }}-tests
  46. - name: tools
  47. emptyDir: {}
  48. restartPolicy: Never
  49. {{- end }}