1
test_name "should be able to modify a host alias"
3
file = "/tmp/hosts-#{Time.new.to_i}"
5
step "set up files for the test"
6
on agents, "printf '127.0.0.8 test alias\n' > #{file}"
8
step "modify the resource"
9
on(agents, puppet_resource('host', 'test', "target=#{file}",
10
'ensure=present', 'ip=127.0.0.8', 'host_aliases=banzai'))
12
step "verify that the content was updated"
13
on(agents, "cat #{file}; rm -f #{file}") do
14
fail_test "the alias was not updated" unless
15
stdout =~ /^127\.0\.0\.8[[:space:]]+test[[:space:]]+banzai[[:space:]]*$/
18
step "clean up after the test"
19
on agents, "rm -f #{file}"