Skip to content

Commit

Permalink
Set facter implementation to rspec
Browse files Browse the repository at this point in the history
This completely disables Facter and uses a stubbed implementation. This
is fine since we use use rspec-puppet-facts to set all facts. It gives
complete isolation from the host system and is also significantly faster
with Facter 4 (which always also resolves the facts, see [FACT-3039]).
It only works with Puppet 6.25+ and 7.12+ and requires rspec-puppet
2.11.0+.

FACT-3039: https://tickets.puppetlabs.com/browse/FACT-3039
  • Loading branch information
ekohl committed Nov 11, 2021
1 parent 6e7e55b commit 5d5bd47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/voxpupuli/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
require 'puppetlabs_spec_helper/module_spec_helper'

RSpec.configure do |config|
# This completely disables Facter and uses a stubbed implementation. This is
# fine since we use use rspec-puppet-facts to set all facts. It gives
# complete isolation from the host system. It only works with Puppet 6.25+
# and 7.12+ and requires rspec-puppet 2.11.0+.
config.facter_implementation = 'rspec'

config.after(:suite) do
RSpec::Puppet::Coverage.report!
end
Expand Down
1 change: 1 addition & 0 deletions voxpupuli-test.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'parallel_tests'
# 4.0.0 provides rubocop annotations in GitHub Actions
s.add_runtime_dependency 'puppetlabs_spec_helper', '>= 4.0.0'
s.add_runtime_dependency 'rspec-puppet', '>= 2.11.0'
s.add_runtime_dependency 'rspec-puppet-facts', '>= 2.0.1', '< 3'
s.add_runtime_dependency 'rspec-puppet-utils', '>= 1.9.5'

Expand Down

0 comments on commit 5d5bd47

Please sign in to comment.