I'm using helm charts to deploy several REST services with into k8s with spring boot inside deployed container.
However, to be able to do final stage testing I need to introduce some sort of smart liveness probe - i.e. that the target application is actually running properly inside given container.
This can be easily justified by successful return code of simple curl
command, however, here's the trick - command needs to be executed with some delay after particular release deployment to give application time to bootstrap.
Here's what I've figured for a test suite:
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "chart.fullname" . }}-test"
labels:
{{- include "chart.fullname" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: test-curl
image: curl
command: ['curl']
args: [' -X POST -i -H "Accept: application/json" -H "Content-Type:application/json" -d ''{"foo":["bar"]}'' {{ include "chart.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
The key problem is that this test will be executed when service is not really started yet and thus fail anyway.
Is there some mechanism or workaround to introduce delay of execution for this test?
Setting some sleep step in separate test container comes to mind but i'm not sure if this will work properly for this case