Containerizing Tests with Docker đłđ
Stefan Teixeira @stefan_teixeira
⢠QA Automation Engineer @ Toptal ⢠Blogs: stefanteixeira.com.br (pt-br) /
stefanteixeira.com (en)
Contact:⢠E-mail: [email protected] ⢠Twitter: twitter.com/stefan_teixeira ⢠LinkedIn: linkedin.com/in/stefanteixeira ⢠GitHub: github.com/stefanteixeira ⢠SlideShare: slideshare.net/stefanteixeira
About me
Docker Compose
⢠Tool for defining and running multi-container applications
https://docs.docker.com/compose/
Docker Compose
⢠Tool for defining and running multi-container applications
⢠Previously known as Fig
https://docs.docker.com/compose/
Docker Compose
⢠Tool for defining and running multi-container applications
⢠Previously known as Fig
⢠YAML â¤
https://docs.docker.com/compose/
Containers != mini-VMs
https://twitter.com/rhein_wein/status/662995114235678720
#1
If tests (except unit tests) are hard to run locally, developers will not run them.
ÂŻ\_(ă)_/ÂŻ
âDocker delivers a predictable, reproducible testing environment."
đłâ¤
(Laura Frank, Codeship)
Demo
⢠Very simple example, with three containers:
⢠App (a REST API written in Node.js) ⢠DB (MongoDB database) ⢠API Tests (written with Supertest)
⢠https://github.com/stefanteixeira/demo-testing-compose
Points of attention
⢠Logs ⢠volumes or data containers
⢠Startup time ⢠wait-for-it, netcat (nc), curl, wait_for module
(Ansible)
Points of attention
⢠Building images ⢠minimal base images: Alpine-linux, Phusion ⢠automate the process
References⢠âStop being lazy and test your softwareâ:
⢠https://www.youtube.com/watch?v=Mx1Il9wIepw ⢠http://www.slideshare.net/rheinwein/stop-being-lazy-and-test-
your-software
⢠https://hharnisc.github.io/2016/06/19/integration-testing-with-docker-compose.html
⢠https://docs.docker.com/compose/startup-order/
⢠https://github.com/vishnubob/wait-for-it
⢠https://www.ansible.com/blog/six-ways-ansible-makes-docker-compose-better
Stefan Teixeira @stefan_teixeira
Thanks!
Top Related