I am using Helm kubernetes deployment and I want to run the postman test cases before a final deployment, and if any test case fails then rollback (or retain the current deployment like Blue-Green deployment). How to achieve this?
Asked
Active
Viewed 699 times
0

Vatan Soni
- 540
- 2
- 11
- 23
-
You can Define readiness probes to do this – M.Elkady Jul 06 '19 at 22:32
-
Have you read about [Chart Tests](https://helm.sh/docs/developing_charts/#chart-tests) in the Helm documentation? Do you have any artifacts or source code so far? – David Maze Jul 06 '19 at 23:14
1 Answers
0
I achieved the expected behavior with Helm Chart Tests and the postman/newman Docker image.
My Helm template for the test execution:
apiVersion: v1
kind: Pod
metadata:
name: API Test
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: PostmanTest
image: postman/newman:latest
args:
- run
- <url-to-postman-collection>
# In case you need to define the hostname in the collection
# Use {{baseUrl}} in the request URL
- --env-var
- baseUrl=<kubernetes-host-name>
After install the helm chart the tests can be executed with
helm test

Simon
- 194
- 13