Sha256: c556c83db12780a376f2207988001eb7aa0c378824ce0f49806644a63f1f14ed

Contents?: true

Size: 1.03 KB

Versions: 18

Compression:

Stored size: 1.03 KB

Contents

test_name "C100151: external fact overrides a custom fact of weight 10000 or less" do
  tag 'risk:high'

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

  fact_name = 'test'
  # Use a static external fact
  ext_fact = "#{fact_name}: 'EXTERNAL'"

  agents.each do |agent|
    facts_dir = agent.tmpdir('facts.d')
    ext_fact_path = "#{facts_dir}/test.yaml"
    cust_fact_path = "#{facts_dir}/test.rb"
    create_remote_file(agent, ext_fact_path, ext_fact)
    create_remote_file(agent, cust_fact_path, custom_fact_content(fact_name, 'CUSTOM', "has_weight 10000"))

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

    # Custom fact with weight <= 10000 should give precedence to the EXTERNAL fact
    step "Agent #{agent}: resolve an external fact over the custom fact with a weight of 10000" do
      on(agent, facter("--external-dir=#{facts_dir} --custom-dir=#{facts_dir} #{fact_name}")) do |facter_output|
        assert_equal("EXTERNAL", facter_output.stdout.chomp)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

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