Build Status Gem Version

Simplify your spec tests by looping on every supported Operating System and populating facts.


The on_supported_os method provided by rspec-puppet-facts provides facts captured from running Vagrant systems. However, many SIMP tests require additional custom facts.

This gem acts as a shim in front of mcanevet/rspec-puppet-facts and can be used as a drop-in replacement when testing for SIMP. It uses a combination of Vagrant-captured SIMP facts and logic to model certain environments (e.g., SELinux modes, LSB facts being present or not).


Basic usage

Use this code inside spec_helper.rb:

require 'simp/rspec-puppet-facts'
include Simp::RspecPuppetFacts

Use this structure inside your *_spec.rb files:

require 'spec_helper'

describe 'module_name::class_name' do
  # loops through and provides facts for each supported os in metadata.json
  on_supported_os.each do |os, base_facts|
    context "on #{os}" do
      let(:facts){ base_facts.dup }
      it { compile.with_all_deps }

Providing options

See the options for details




[default: {}]

Override or add extra facts to each os/facts hash.

NOTE: Facts managed by internal logic (such as :selinux, :selinux_current_mode, :tmp_mount_*, etc) will still be overwritten. To avoid this, use :extra_facts_immutable instead.


[default: {}]

Override or add extra facts to each os/facts hash. These facts cannot be altered by internal logic (such as :selinux_mode).


[default: :enforcing]

Given an enforcement mode (:enforcing, :permissive, or :disabled), overrides the following facts:

  • selinux
  • selinux_enforced
  • selinux_current_mode
  • selinux_state
  • tmp_mount_* (only modifies existing tmp_mount* facts)

Example: Default SELinux mode (:enforcing)

# Default facts (`.first.last` returns facts for the first os)
facts_hash = on_supported_os.first.last
### => [true, "enforcing", "enforcing", "rw,relatime,seclabel"]

Example: Setting facts to model when SELinux is disabled

# Set selinux mode to `disabled`
facts_hash = on_supported_os({:selinux_mode => :disabled}).first.last
### => [false, "disabled", "disabled", "rw,relatime"]

Environment Variables


Set to install a specific version of facter. Only works on systems where puppet can be installed natively via gem.


Set to yes to switch over to using facter-ng (Facter 4) for collection.

Requires using beaker to collect facts.


Restricts test matrix to OS strings/partial strings/regexps provided in a comma-delimited list.

  • Example: SIMP_FACTS_OS=redhat-7-x86_64,centos


Mock the output of historical lsb facts

  • Disable by setting to no

How to capture new facts

Beaker (preferred)

  • Add nodesets to spec/acceptance/nodesets
  • Run bundle exec rake beaker:suites[default,ALL]
    • Replace ALL with the name of a specific nodeset if you only want to collect on a single OS.
  • Review the facts in the collected_facts directory.
  • Update the facts in the associated facts directory.
    • Make sure to rename the file as <lowercase_os>-<major_version>-<arch>


  • Place any modules containing facts you want to capture under modules/
  • Run vagrant up NOTE: This replaces any older fact data