kubernetes - 如果任何测试失败,如何通过 helm 运行 Postman 测试用例并回滚到上一个成功的版本
问题描述
我正在使用 Helm kubernetes 部署,我想在最终部署之前运行邮递员测试用例,如果任何测试用例失败,则回滚(或保留当前部署,如蓝绿部署)。如何做到这一点?
解决方案
我使用Helm Chart Tests和postman/newman Docker image实现了预期的行为。
我用于测试执行的 Helm 模板:
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>
安装 helm chart 后,可以使用以下命令执行测试
掌舵测试
推荐阅读
- dolphindb - 如何在 dolphindb 中以交互方式取消任务
- linux - 如何使用终端更改 Linux 上的 git 帐户?
- r - R 鼠标功能不应用自定义预测矩阵
- android - 如何使用 inSampleSize() 和 inJustDecodeBounds() 从 MediaStore 解码位图
- git - 选择分支来构建 Jenkins 工作的最新更改
- angular - 在离子搜索框中设置去抖动,角度不起作用
- python-3.x - 如何将 pandas.assign 与 lambda 和 if 条件一起使用
- javascript - 数据表中的 PHP 重定向按钮不起作用
- c# - 如何在 CodeFirst 中使用 WHERE 子句中的 JSON_VALUE 进行类型转换
- sql - SQL 从两个或多个不相关的表中选择所有列