1
test_name "should be able to remove a host record"
3
file = "/tmp/hosts-#{Time.new.to_i}"
4
line = "127.0.0.7 test1"
6
step "set up files for the test"
7
on agents, "printf '#{line}\n' > #{file}"
9
step "delete the resource from the file"
10
on(agents, puppet_resource('host', 'test1', "target=#{file}",
11
'ensure=absent', 'ip=127.0.0.7'))
13
step "verify that the content was removed"
14
on(agents, "cat #{file}; rm -f #{file}") do
15
fail_test "the content was still present" if stdout.include? line
18
step "clean up after the test"
19
on agents, "rm -vf #{file}"