如果任何测试失败,如何通过掌舵运行Postman测试用例并回滚到上一个成功的版本 [英] How to run Postman test cases by helm and rollback to last successful version if any test fail
本文介绍了如果任何测试失败,如何通过掌舵运行Postman测试用例并回滚到上一个成功的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Helm kubernetes部署,我想在最终部署之前运行邮递员测试用例,如果任何测试用例失败,则回滚(或保留当前的部署,例如Blue-Green部署). 如何实现呢?
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?
推荐答案
我通过实现了预期的行为Helm Chart Tests 和 postman/newman Docker映像.
用于测试执行的我的Helm模板:
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
头盔测试
这篇关于如果任何测试失败,如何通过掌舵运行Postman测试用例并回滚到上一个成功的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文