使用 drone.io 进行集成测试

Integration testing with drone.io

我正在使用一个名为 Drone(drone.io) 的 CI 工具。所以我真的很想用它做一些集成测试。我想要的是无人机在无人机主机上的某个端口上启动我的应用程序容器,然后我将能够针对它进行 运行 集成测试。例如在 .drone.yml 文件中:

build:
  image: python3.5-uwsgi
  pull: true
  auth_config:
      username: some_user
      password: some_password
      email: email
  commands:
      - pip install --user --no-cache-dir -r requirements.txt
      - python manage.py integration_test -h 127.0.0.1:5000 
# this should send various requests to 127.0.0.1:5000
# to test my application's behaviour 

compose:
   my_application:
     # build and run a container based on dockerfile in local repo on port 5000


publish:

deploy:

Drone 0.4 无法从你的 Dockerfile 启动服务,如果你想启动 docker 容器,你应该在此构建之前构建它,然后推送到 dockerhub或您自己的注册表并将其放入撰写部分,请参阅 http://readme.drone.io/usage/services/#images:bfc9941b6b6fd7b4ef09dd0ccd08af0c

您还可以在构建中启动您的应用程序,nohup python manage.py server -h 127.0.0.1:5000 & 在您 运行 进行集成测试之前。在你 运行 integration_test.

之前,请确保你的应用程序已启动并侦听 5000 端口

我建议您使用带管道的无人机 0.5,您可以构建 docker 图像并在构建之前将其推送到注册表,并在您的构建中将其用作服务。