-- mode: markdown; mode: visual-line; --

Bash Puppet Module Tests with Vagrant

The best way to test this module in a non-intrusive way is to rely on Vagrant. Vagrant uses Oracle's VirtualBox to build configurable, lightweight, and portable virtual machines dynamically.

The Vagrantfile at the root of the repository pilot the provisioning of many vagrant boxes generated through the vagrant-vms repository and available on Vagrant cloud.

You can list the available vagrant box as follows:

   $> vagrant status 
   Current machine states:

   centos-7                  not created (virtualbox)
   debian-7                  not created (virtualbox)

   This environment represents multiple VMs. The VMs are all listed
   above with their current state. For more information about a specific
   VM, run `vagrant status NAME`.

As suggested, you can run a debian 7 machine for instance by issuing:

  $> vagrant up debian-7

Then you can ssh into the machine afterwards:

  $> vagrant ssh debian-7

When you run vagrant up <os> to boot the VM, it is configured to be provisioned with the .vagrant_init.rb script. This script is responsible for two main tasks:

  1. pre-install the puppet modules listed as dependencies in metadata.json
  2. make the appropriate symbolic link in the puppet module directory (to /vagrant) to ensure you can directly make changes and correct your own module transparently within the box.

So you can test the manifests of the tests/ directory within the VM:

  $> vagrant ssh <os>
  (vagrant)$> sudo puppet apply -t /vagrant/tests/init.pp

From now on, you can test (with --noop) the other manifests.

Run vagrant halt (or vagrant destroy) to stop (or kill) the VM once you've finished to play with it.

Note: The Vagrantfile at the root of this repository might evolve over the time with new boxes. To automatically get the last version available:

  1. Upgrade the falkorlib gem

      $> bundle update falkorlib
      $> git commit -s -m "Upgrade falkorlib to the latest version" Gemfile.lock
  2. update the Vagrantfile to the last version by issuing:

      $> rake templates:upgrade:vagrant