在Kubernetes堆栈上运行集成/ e2e测试 [英] Running integration/e2e tests on top of a Kubernetes stack

查看:185
本文介绍了在Kubernetes堆栈上运行集成/ e2e测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究人们在Kubernetes环境下运行集成和e2e测试的方式,并且由于缺乏文档和反馈而感到非常失望。我知道有很棒的工具,例如kind或minikube,可以在本地运行资源。但是,在CI的情况下,并且有大量服务,由于明显的资源原因,它似乎不太适合。我认为运行测试的机会很大:

I’ve been digging a bit into the way people run integration and e2e tests in the context of Kubernetes and have been quite disappointed by the lack of documentation and feedbacks. I know there are amazing tools such as kind or minikube that allow to run resources locally. But in the context of a CI, and with a bunch of services, it does not seem to be a good fit, for obvious resources reasons. I think there are great opportunities with running tests for:


  • 验证清单或头盔图表

  • 验证组件作为较大整体的一部分的行为方式

  • 验证产品的全局行为

这里的重点不是测试框架,而是测试可以在其上运行的环境。

The point here is not really about the testing framework but more about the environment on top of which the tests could be run.

您是否同意我的想法?您是否经历过运行此类测试的经历?您对此有任何反馈或见解吗?

Do you share my thought? Have you ever experienced running such kind of tests? Do you have any feedbacks or insights about it?

非常感谢

推荐答案

有趣的问题,以及我在过去几个月中为当前雇主所做的工作。本质上,我们将产品作为带有清单的docker映像进行运输。编写e2e测试时,我想尽可能地在客户环境附近运行产品。

Interesting question and something that I have worked on over the last couple of months for my current employer. Essentially we ship a product as docker images with manifests. When writing e2e tests I want to run the product as close to the customer environment as possible.

本质上为解决此问题,我们构建了与标准云提供商交互的脚本( (GCloud)创建集群,部署产品,然后对其进行测试。

Essentially to solve this we have built scripts that interact with our standard cloud provider (GCloud) to create a cluster, deploy the product and then run the tests against it.

对于主要的云提供商而言,这并不是一件困难的事情,但可能会很耗时。在开发测试时,我们已经了解了一些很难记住的方法。

For the major cloud providers this is not a difficult tasks but can be time consuming. There are a couple of things that we have learnt the hard way to keep in mind while developing the tests.


  1. 并发性,这听起来很明显但是请考虑一下CI可以运行的并发构建数量。

  2. 来自云的延迟,不要以为您会立即响应在云中运行的每个命令。还考虑超时。如果您提出的产品具有大量的Pod和服务,那么可接受的启动时间是多少?

  3. 导致构建失败的错误,这很有趣。与我们的测试部署进行通信时,我们已经看到由于网络错误而导致的构建错误。这些几乎总是可传递的。最好避免这些使构建失败。

值得一提的是,GitLab提供了一些文档关于如何在其CI管道中构建和测试图像。

One thing to look at is GitLab are providing some documentation on how to build and test images in their CI pipeline.

这篇关于在Kubernetes堆栈上运行集成/ e2e测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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