Update from xaque208 modulesync_config

This commit is contained in:
Zach Leslie
2019-12-22 21:33:39 -08:00
parent f43e6918cf
commit 1c133dd430
6 changed files with 50 additions and 70 deletions

View File

@@ -7,8 +7,14 @@ end
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
require 'bundler'
include RspecPuppetFacts
if ENV['DEBUG']
Puppet::Util::Log.level = :debug
Puppet::Util::Log.newdestination(:console)
end
if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml')))
if facts
@@ -31,10 +37,23 @@ if Dir.exist?(File.expand_path('../../lib', __FILE__))
add_filter '/spec'
add_filter '/vendor'
add_filter '/.vendor'
add_filter Bundler.configured_bundle_path.path
end
end
RSpec.configure do |c|
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
# see https://github.com/camptocamp/facterdb
# people might provide a specific facter version. In that case we use it.
# Otherwise we need to match the correct facter version to the used puppet version.
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
# https://puppet.com/docs/puppet/5.5/about_agent.html
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
end
# Coverage generation
c.after(:suite) do
RSpec::Puppet::Coverage.report!