This post is originally published on Emilien Macchi’s blog.
During the last OpenStack Summit, I had the pleasure to participate to the Infra sessions and we agreed at how to make functional testing for both Puppet OpenStack and Puppet Infra modules, which is a real proof of collaboration between both groups.
However, I met some people still wondering how to test a patch in a Puppet module without affecting our own system by installing OpenStack.
This article is short but effective: it’s about testing a Puppet module by using Vagrant with OpenStack provider and Beaker.
- Linux, Windows or MAC OS X.
- You need to install Vagrant on your system.
- An access to an OpenStack Cloud (or use libvirt Vagrant provider, but not explained in this article).
This example will test a specific patch of puppet-keystone on CentOS7, but you can adapt the Vagrant file to spawn a Ubuntu Trusty image.
Before running any command, let’s see what we are doing here.
Here is the Vagrantfile used to provision a virtual machine in the OpenStack Cloud. You’ll need to adjust your credentials:
This is the script that will be run inside the VM to prepare the system and run the functional tests. You can adapt the module and patchset you want to test:
Open a terminal, and let’s start:
vagrant plugin install vagrant-openstack-provider
vagrant box add dummy https://github.com/cloudbau/vagrant-openstack-plugin/raw/master/dummy.box
vagrant up --provider=openstack --debug # --debug will help to see in real-time the ssh output when running the script within the VM
Here is a demo of what happens.
The script and Vagrantfile are here for information but you’ll probably have to adjust them to test what you like.
My next step is to look at OpenStack hypervisor provided by Beaker itself, but it’s still experimental.