0

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?

Vatan Soni
  • 540
  • 2
  • 11
  • 23

1 Answers1

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