summaryrefslogtreecommitdiffstats
path: root/accecptance/tests/ticket_7039_facter_multiple_facts_one_file.rb
blob: fb78628856534b150cfea6b2db01a1d43a3bb117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
test_name "#7039: Facter having issue handling multiple facts in a single file"

fact_file= %q{
Facter.add(:test_fact1) do
    setcode do
        "test fact 1"
    end
end

Facter.add(:test_fact2) do
    setcode do
        "test fact 2"
    end
end
}

agent1=agents.first
step "Agent: Create fact file with multiple facts"
create_remote_file(agent1, '/tmp/test_facts.rb', fact_file )

step "Agent: Verify test_fact1 from /tmp/test_facts.rb"
on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact1") do
    fail_test "Fact 1 not returned by facter --puppet test_fact1" unless
      stdout.include? 'test fact 1'
end

step "Agent: Verify test_fact2 from /tmp/test_facts.rb"
on(agent1, "export FACTERLIB=/tmp && facter --puppet test_fact2") do
    fail_test "Fact 1 not returned by facter --puppet test_fact2" unless
      stdout.include? 'test fact 2'
end