Skip to content
Snippets Groups Projects
Select Git revision
  • 0395f002451a7a7aa7c9ed9045a6b68fdaafe53e
  • master default protected
  • 5.x
  • ll-php8-bs5
  • release_5_bs5
  • ll-php8
  • 4.x
  • laminas_migration
  • release_1.0.0.2
  • release_4.0.0
  • release_3.2.8
  • bootstrap4_migration
  • 1.0.0.3
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 5.1.1
  • 6.0.0
  • 5.1.0
  • 5.0.0
  • 4.0.2
  • 3.2.11
  • 4.0.1
  • 3.2.10
  • 4.0.0
  • 1.0.0.2
  • 3.2.9
  • 3.2.8
32 results

installation.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    spec_helper.rb 1.75 KiB
    require 'puppetlabs_spec_helper/module_spec_helper'
    
    RSpec.configure do |c|
      c.include PuppetlabsSpec::Files
    
      c.before :each do
        # Ensure that we don't accidentally cache facts and environment
        # between test cases.
        Facter::Util::Loader.any_instance.stubs(:load_all)
        Facter.clear
        Facter.clear_messages
    
        # Store any environment variables away to be restored later
        @old_env = {}
        ENV.each_key {|k| @old_env[k] = ENV[k]}
    
        if Gem::Version.new(`puppet --version`) >= Gem::Version.new('3.5')
          Puppet.settings[:strict_variables]=true
        end
    
        if ENV['PUPPET_PARSER'] == 'future'
          Puppet.settings[:parser]='future'
        end
      end
    
      c.after :each do
        PuppetlabsSpec::Files.cleanup
      end
    end
    
    require 'pathname'
    dir = Pathname.new(__FILE__).parent
    Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules')
    
    # There's no real need to make this version dependent, but it helps find
    # regressions in Puppet
    #
    # 1. Workaround for issue #16277 where default settings aren't initialised from
    # a spec and so the libdir is never initialised (3.0.x)
    # 2. Workaround for 2.7.20 that now only loads types for the current node
    # environment (#13858) so Puppet[:modulepath] seems to get ignored
    # 3. Workaround for 3.5 where context hasn't been configured yet,
    # ticket https://tickets.puppetlabs.com/browse/MODULES-823
    #
    ver = Gem::Version.new(Puppet.version.split('-').first)
    if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver
      puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
      # libdir is only a single dir, so it can only workaround loading of one external module
      Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
    end