码头单元测试设置 [英] docker unit test setup

查看:144
本文介绍了码头单元测试设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的产品设置单元测试环境。我有一个web应用程序构建在nginx在Lua使用mysql和redis。 我认为码头工人对于这个虽然我是新来的码头工作者我的应用程序在centos服务器(生产服务器)上运行。

I want to setup a unit test environment for my product. I have a web application build on nginx in Lua which use mysql and redis. I think docker will be good for this although i am new to docker. My application runs on centos server (production server).

我打算为mysql,redis和webapp设置不同的容器,然后写入UT应用程序(Lua的单元测试破解框架)在我的mac(我的开发机器是MAC)或VM来测试它。 UT应用程序会与docker容器nginx进行通信,nginx将使用容器mysql和redis。这个好吗 ?如果是的话,有人能指导我怎么做吗?也许一些很好的链接?如果没有,什么可以是更好的方法。我已经尝试使用流氓,但花了太多时间,这不应该在我的UT案件。

I am planning to setup different container for mysql,redis and webapp and then write UT application (unit test for Lua using Busted framework) in my mac (My development machine is MAC) or VM to test it. The UT application will talk to docker container nginx and nginx will use container mysql and redis. Is this good ? If yes ,can someone guide me how to do this? maybe some good link? If no , what could be better way. I have already tried using vagrant but that took too much time which shouldn't be in my UT case.

推荐答案

有关如何设置项目模板的示例,您可以看一下 phundament / app 及其测试设置。

For an example how we setup our project template you may have a look at phundament/app and its testing setup.

我们正在使用码头化的 GitLab 使用定制赛程进行安装,该运行程序能够执行 docker-撰写

We are using a dockerized GitLab installation with a customized runner, which is able to execute docker-compose.


注意!跑步者本身正在一个单独的Docker主机上运行。

Note! The runner itself is running on a separate Docker host.

我们使用 docker-compose.yml 来定义服务在一个堆栈中,调整了开发测试

We are using docker-compose.yml to define the services in a stack with adjustments for development and testing.

CI配置经过优化,可以处理孤立堆栈的多个并发测试,只需指定一个自定义的 COMPOSE_PROJECT_NAME

The CI configuration is optimized to handle multiple concurrent tests of isolated stacks, this is just done by specifying a custom COMPOSE_PROJECT_NAME.

有关我们测试过程的一些深入文档以及有关 docker-compose 和dockerized CI的有用信息。

Some in-depth documentation about our testing process and useful information about docker-compose and dockerized CI.

  • #testing README
  • #testing Docs
  • CI builds
  • Extending services and Compose files
  • Docker-in-Docker for CI?

最后, Travis CI 一直支持Docker,但我还没有测试这种方法。

Finally, Travis CI also supports Docker since a while, but I haven't tested this approach at all.

这篇关于码头单元测试设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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