Camptocamp – News

Puppet Acceptance Testing on Travis CI

29 Januar 2015

Camptocamp is developing lots of Puppet modules and is using more and more often acceptance tests with beaker to prevent regressions. Beaker is a powerful framework to add acceptance tests to Puppet modules. It allows to use all sorts of hypervisor backends (docker, vagrant, aws, openstack, etc.). Unfortunately, it is not (yet) possible to launch specific docker containers or vagrant boxes on Travis CI. Since Camptocamp has its own OpenStack private cloud, we had the idea to use Beaker’s OpenStack hypervisor to spawn VMs on our own Openstack infrastructure from Travis CI, in order to automate acceptance tests runs. And this is how we are doing it.

Simple .travis.yml

First, let’s write a very simple .travis.yml file:

Simple nodeset

Then a simple nodeset:

This should work locally, but not from Travis CI because it (hopefully) doesn’t have access to your private key, so you have to generate a new public key and add its keypair to Openstack. You’ll need this patch: https://github.com/puppetlabs/beaker/pull/647 You then need to remove the openstack_keyname from your nodeset. Now, it should work fine, but you certainly don’t want to publish your credentials with your code, so let’s secure it a little…

Encrypt your credentials using travis encrypt

You’ll need this patch: https://github.com/puppetlabs/beaker/pull/643 Use the travis gem to encrypt and add your credentials to your .travis.yml.

You can then remove them from your nodeset.

Finally…

Finally, you should have something like this: .travis.yml

nodeset

While waiting for Travis CI to allow spawning specific Docker Container or virtualbox, we now have acceptance tests automatically launched and historized. Here is an example of Travis CI output using this method on our puppet-openldap module: