summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/resource/host/should_query.rb
blob: 76f84e49849e65b294c05992dd634c405d825407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
test_name "should query hosts out of a hosts file"

file = "/tmp/hosts-#{Time.new.to_i}"

step "set up the system for the test"
on agents, "printf '127.0.0.1 localhost.local localhost\n' > #{file}"

step "fetch the list of hosts from puppet"
on(agents, puppet_resource('host', 'localhost', "target=#{file}")) do
    found = stdout.scan('present').length
    fail_test "found #{found} hosts, not 1" if found != 1
end

step "clean up the system"
on agents, "rm -f #{file}"