Using Cumulus VX with Beaker

  • 2
  • Article
  • Updated 3 years ago
Beaker is an acceptance testing tool developed by Puppet Labs. This article shows you how to use Cumulus VX with Beaker to test your Puppet manifests.

Configuring Beaker

Focusing on Beaker RSpec, there are two main components when configuring Beaker; the RSpec helper and a Nodeset file which describes the virtual machines that are created by Beaker.


The Nodeset file is written in YAML. A simple default Nodeset that creates a single Cumulus VX virtual machine would be:
      - master
    platform: debian-253-amd64
    box: cumulus-vx-2.5.3
    hypervisor: vagrant

  type: foss
There are a few things worth noting about this configuration:
  • The "platform" is "Debian". Beaker does not natively support Cumulus Linux but does support Debian, which supports everything we need.
  • We're using Vagrant as the hypervisor. By default the Cumulus VX Vagrant box in turn uses VirtualBox, so Beaker will ultimately create a VirtualBox virtual machine using Vagrant.
  • The "type" is set to FOSS as we will install Open Source Puppet from the Cumulus Networks APT repository when the virtual machine is created.
RSpec Helper

The RSpec helper is again quite simple:
require 'beaker-rspec'
require 'pry'

hosts.each do |host|
  # Install Puppet
  on host, 'apt-get update && apt-get install -y puppet'

RSpec.configure do |c|
  module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

  c.formatter = :documentation

  # Configure all nodes in nodeset
  c.before :suite do
    # Install module
    puppet_module_install(:source => module_root, :module_name => 'example')
    hosts.each do |host|
      on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
The only major difference is that instead of using the predefined install_puppet method, we install Puppet from the Cumulus Networks APT repository using apt-get, as the standard Puppet Labs installer does not recognise Cumulus Linux and will fail to install Puppet.

Putting It All Together

Given the above Nodeset and RSpec helper, it's simple to then create new tests. Let's create a simple example as follows:
├── Gemfile
└── spec
    ├── acceptance
    │   ├── example_spec.rb
    │   └── nodesets
    │       └── default.yml
    └── spec_helper_acceptance.rb
With the Nodeset default.yml and spec_helper_acceptence.rb as above, and example_spec.rb as
require 'spec_helper_acceptance'

describe 'users' do

  context 'creating a new user' do

    it 'should create the turtle user' do
      pp = <<-EOS
        user { 'turtle':
          ensure => present,

      apply_manifest(pp, :catch_failures => true)

    describe user('turtle') do
      it { should exist }


When we run Beaker with bundle exec rspec spec/acceptance, Beaker will:
  • Create a new Cumulus VX virtual machineusing Vagrant
  • Install Puppet from the Cumulus Networks APT repository
  • Run the example_spec.rb test, which will create a new user ('turtle') and then test the outcome.
  • Report the Serverspec test status and destroy the Vagrant virtual machine.
Related Links
Photo of Kristian Van Der Vliet

Kristian Van Der Vliet, Alum

  • 290 Points 250 badge 2x thumb

Posted 3 years ago

  • 2

Be the first to post a reply!