Sha256: 870f48f4bb66eaf6ea5fa6e07fcd6592bb2f8c7007abcee1e473228000eae422

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

# This test verifies that --no-custom-facts keeps facter from loading facts from the environment
# variable FACTERLIB
test_name "C100000: custom fact commandline options --no-custom-facts does not load from FACTERLIB" do
  tag 'risk:low'

  require 'facter/acceptance/user_fact_utils'
  extend Facter::Acceptance::UserFactUtils

  content = <<EOM
Facter.add('custom_fact') do
  setcode do
    "testvalue"
  end
end
EOM

  agents.each do |agent|
    step "Agent #{agent}: create a custom fact directory and fact" do
      facterlib_dir = agent.tmpdir('facterlib')
      custom_fact = File.join(facterlib_dir, 'custom_fact.rb')
      create_remote_file(agent, custom_fact, content)

      teardown do
        on(agent, "rm -rf '#{facterlib_dir}'")
      end

      step "Agent #{agent}: --no-custom-facts should ignore the FACTERLIB environment variable" do
        on(agent, facter('--no-custom-facts custom_fact', :environment => { 'FACTERLIB' => facterlib_dir })) do |facter_output|
          assert_equal("", facter_output.stdout.chomp, "Custom fact in FACTERLIB should not have resolved")
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
facter-4.0.29 acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-4.0.28 acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.2.cfacter.20181217 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.1.cfacter.20181031 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.6.cfacter.20181031 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.1.cfacter.20181023 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.5.cfacter.20181022 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.0.cfacter.20181004 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.0.cfacter.20181001 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.12.0.cfacter.20180918 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.4.cfacter.20180821 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.3.cfacter.20180716 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.2.cfacter.20180612 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.9.6.cfacter.20180612 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.2.cfacter.20180606 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.9.6.cfacter.20180606 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
facter-3.11.0.cfacter.20180319 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb
cfacter-3.11.0.rc.20180314 ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb