Docker Container Testing…in Parallel

Like many in DevOps, I’ve sipped the Docker Kool-Aid and like how it tastes. Being able to standup any well-balanced combination of servers pretty much at will to handle load is a beautiful thing. I almost feel embarrassed that it was just a handful of years ago that I had to explain to a previous coworker “if we need to buy another web server, we are going to need another application server and possibly another database server…and at that point we might as well throw in a couple more web servers”. One could say virtual machines, Amazon AWS, and Docker have allowed me to break through the wall of considering servers in permanent integer amounts.

One of my favorite parts of working at Solano Labs is the exposure to the ever-changing landscape of DevOps technologies. We take questions like “do you support technology XYZ?” almost as personal challenges. After a couple Docker-support questions, I decided to whip up a relatively simple example repository demonstrating building Docker images/containers on Solano CI. (After a “do you support deploying to Amazon ECS?” inquiry, I quickly updated the repo to demonstrate that capability.)

Since the repository is only serving a single web page, I initially included a very minimal test suite (basically if the page rendered, it passed) in the container itself. Even though it is just an example repository, there were a couple of issues with this approach:

  1. It really only demonstrated building Docker containers, and not accessing them as part of a larger, more comprehensive test suite.
  2. By including the test suite in the container, the tests could only run in serial, and thus not living up to our FAQ: “Solano CI automatically and intelligently parallelizes automated software tests to deliver results 10 to 80 times faster than existing solutions.”
  3. Considering continuous integration and testing pay the bills here, there was the chance that co-workers would launch a barrage of flying rockets at me due to the tiny test suite. (I’d like to thank a Pivotal conference booth for introducing the rockets to us.)

I’ve addressed the first two issues by updating the example repository. It now builds the Docker container during the pre_setup hook, allowing the subsequent setup hooks and each of the parallel test workers to access the container. To take advantage of this, a more comprehensive test suite now runs PHPUnit tests in parallel.

Since there is only so much testing you can do against such simple functionality, I may need to invest in a foam shield of some sort to address the last issue.

Post a Comment