Reduce local test kitchen runtimes

At Zanui we’ve been working with Vagrant, Puppet and Chef for quite a while. We’re happy with these tools, at least most of the time.

A major discomfort is the time taken to download any kind of assets during provisioning, e.g.

  • Omnibus: Chef Install
  • Apt update / packages
  • Pip packages

While this is annoying it’s usually not an issue for non-repetitive runs. These usually occur with a new team member or when a development box needs to be rebuild due to errors.

The opposite is the case for test kitchen runs. Testing your cookbook multiple times on multiple systems is crucial but a burden when it slows you down.

vagrant-cachier is the first idea that comes to mind to improve runtimes. Unfortunately kitchen doesn’t support vagrant-cachier directly. Instead you need to create a Vagrantfile ERB template and eventually maintain it in your repository. Not pretty.

Another idea is to use an HTTP Proxy as an intermediate to store any kind of downloads over multiple kitchen runs. Fletcher Nichol created a nice little snippet that you just chuck into $HOME/.kitchen/config.yml then install a proxy such as polipo and you’re good to go.

I had mediocre success with polipo, even after building it from master. A more stable solution is SquidMan. It’s a fancy interface on top Squid. SquidMan - Preferences - General You want to bump up the Cache size and Maximum object size to maximum. And allow access to either your IP or an entire network range. SquidMan - Preferences - Clients