Posts

Showing posts from May, 2015

How to write end to end tests for NGINX using Docker and WireMock

Image
A reverse proxy such as NGINX or Apache seems to be a common feature of many systems, yet they often lack the tests associated with the business logic in the application(s) it proxies.  Here I will show how, with the benefit of Docker and WireMock , to write tests that verify your config in isolation. Git project here . The Problem   Without tests for a reverse proxy, bugs are found on deployment in a real environment with some other unrelated suite of acceptance tests failing.  This has many drawbacks: Bugs are found later (typically after committing, building and deploying) which increases your edit, compile, debug cycle. It's impossible to approach your development in a TDD fashion. Without tests in the same code base, you have to rely on comments or documentation to describe the intended behaviour. The Solution    Test your proxy in isolation, end to end, using WireMock and Docker . Docker allows us to build and run the proxy in a reliable and repeata