How do you write a `helm test`?
BeginnerConceptHooks, Tests & Validation
Answer
A Pod (or Job) in templates/tests/ annotated with helm.sh/hook: test whose container exits 0 on success:
apiVersion: v1
kind: Pod
metadata:
name: {{ include "shop.fullname" . }}-test-api
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation
spec:
restartPolicy: Never
containers:
- name: curl
image: curlimages/curl:8.10.1
args: ["-fsS", "http://{{ include "shop.fullname" . }}-api:3000/readyz"]
helm test shop -n shop --logs --timeout 2m