4 ms·
Docker builds need a smoke test
- linsomniac 7y agoItamar: I was hoping you'd go more into WHY the end-to-end tests are too late. Docker 1.12 introduces the "HEALTHCHECK" for Dockerfiles: HEALTHCHECK CMD curl --fail http://localhost:8000 http://localhost:8000 || exit 1 Is the issue that E2E tests are too heavyweight to be run as a health-check, or that E2E tests are done after the service is running in production? One nice thing about HEALTHCHECK is that it can be used as part of the deploy process, stopping it before the servers come into the load, like in a blue/green roll-out. "docker service update" can use that check to manage the rollout to production. I think the case you are making is that that's too late though, you want to notify the developer earlier? Do people really "deploy to prod" without "deploy to staging" first? Maybe I'm just living in my own little world, but we always deploy to staging before production. We have a gatekeeper that prevents code from going directly to production, but maybe we are in the minority there.
- itamarst 7y agoEnd-to-end tests work, it's just that as I talk about it slows down the feedback loop a lot. Smoke test: "Your Docker image is broken", immediately after `docker build`. End-to-end tests: 30 minutes later "all your tests failed with timeouts". An image with HEALTHCHECK could be one way to do a smoke test: check if the healthcheck passed. However Kubernetes has a different mechanism so I suspect people using Docker with K8s don't bother using HEALTHCHECK.