I'm not sure if it's a bug from helm (using version 3.0.2) or a problem of config from me.
When I launch helm test command with --logs option, I receive an error before the end of the tests (tests which are ok, with normal logs, as I can read with kubectl logs).
Test pod is "not found", because it has a specific name like "myproject-django-test-tjbhc" (unlike job which is correctly named as expected).
$ helm test $RELEASE --logs --namespace $NAMESPACE
NAME: myproject-test
LAST DEPLOYED: Fri Feb 14 10:10:03 2020
NAMESPACE: myproject-test-vjuh-init-helm
STATUS: deployed
REVISION: 1
TEST SUITE: myproject-test-django-test
Last Started: Fri Feb 14 10:13:16 2020
Last Completed: Fri Feb 14 10:18:16 2020
Phase: Failed
NOTES:
Deployed!
Error: unable to get pod logs for myproject-test-django-test: pods "myproject-test-django-test" not found
ERROR: Job failed: exit code 1
yaml:
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-django-test"
labels:
app: {{ template "myproject.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
annotations:
"helm.sh/hook": test
spec:
template:
metadata:
name: "{{ .Release.Name }}-django-test"
spec:
containers:
- name: main
image: {{ template "myproject.django.image" . }}
imagePullPolicy: "{{ .Values.myproject.django.pullPolicy }}"
args:
- test
This seems to be a bug in Helm 3. I have created an issue on GitHub for this - lets see what happens to it.
As a temporary fix, you can stop your tests Pods from getting deleted by annotating your test Pods with:
"helm.sh/hook-delete-policy": before-hook-creation