集成测试使用“安全测试"对部署的服务进行测试. [英] Integration testing deployed services using "helm test"

查看:146
本文介绍了集成测试使用“安全测试"对部署的服务进行测试.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用掌舵图将多个REST服务部署到Microsoft Azure. 这些服务中的一些彼此通信,并与某些数据库通信.部署后,我想测试一切"是否按预期工作.更确切地说,我想向其中一项服务发送一些HTTP请求,并检查响应是否有意义.当然是在自动化测试中.

I'm using helm charts to deploy several REST services to Microsoft Azure. Some of these services communicate with each other and to some databases. After the deployment I want to test if "everything" works as expected. To be more precise, I want to send some HTTP requests to one of the services and check if the response makes sense. In automated tests of course.

我看到可以在部署后使用头盔测试" ,但这并不是我真正需要的.

I saw that it's possible to run basic commands after the deployment using "helm test", but this is not exactly what I need.

在较早的方法中,我使用 Newman 执行 Postman 集合. Postman集合定义了几个请求以及相应的测试.

In some earlier approach I used Newman to execute a Postman collection in a script after the deployment. The Postman collection defined several requests and the corresponding tests.

现在我不知道如何在新环境(Azure)和部署管道(helm,k8s)中做到这一点.

Now I don't know how to do it in the new environment (Azure) and deployment pipeline (helm, k8s).

再次拥有这样的东西会很好. 但是对我来说,如何做到这一点还不清楚,例如

It would be nice to have something like this again. But for me it's not clear how to do it, e.g.

  • 如何在"helm test"范围内使用Newman?
  • 我如何才能确保开始测试之前已部署的Pod全部正在运行"(需要等待时间?状态检查?)?

newman run "test.postman_collection.json" -e "azure.postman_environment.json" --bail

推荐答案

Helm测试非常灵活,因为它可以运行任何Kubernetes YAML(包括任何Docker映像).例如,您可以检查 MySQL Helm Chart测试.

Helm test is very flexible, because it runs any Kubernetes YAML including any Docker image. As an example, you can check tests for the MySQL Helm Chart.

所以,请问您的问题:

  1. 要使用Newman,只需找到安装了Newman的Docker映像(例如,官方的

  1. To use Newman, you just need to find a Docker image with the Newman installed (e.g. the official one postman/newman or build your own). To use your JSON configuration files, you can either put them as ConfigMap or copy them into the container. Check he MySQL Helm Chart for more details.

您说对了,您需要等到系统就绪后再运行测试. AFAIK对此不包括在Helm Test中.因此,您需要将sleep放入脚本中,或者主动使用kubectl进行检查,直到POD准备就绪.

You're right that you need to wait until your system is ready before running the tests. AFAIK this is not covered by Helm Test. So you need to either put sleep into your script or actively check with kubectl until the PODs are ready.

这篇关于集成测试使用“安全测试"对部署的服务进行测试.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆