diff --git a/acceptance/tests/resource/host/should_query_all.rb b/acceptance/tests/resource/host/should_query_all.rb index 24eb438c6..4506fcca7 100755 --- a/acceptance/tests/resource/host/should_query_all.rb +++ b/acceptance/tests/resource/host/should_query_all.rb @@ -1,28 +1,28 @@ test_name "should query all hosts from hosts file" content = %q{127.0.0.1 test1 test1.local 127.0.0.2 test2 test2.local 127.0.0.3 test3 test3.local 127.0.0.4 test4 test4.local } agents.each do |agent| backup = agent.tmpfile('host-query-all') step "configure the system for testing (including file backups)" on agent, "cp /etc/hosts #{backup}" on agent, "cat > /etc/hosts", :stdin => content step "query all host records using puppet" on(agent, puppet_resource('host')) do found = stdout.scan(/host \{ '([^']+)'/).flatten.sort fail_test "the list of returned hosts was wrong: #{found.join(', ')}" unless found == %w{test1 test2 test3 test4} count = stdout.scan(/ensure\s+=>\s+'present'/).length fail_test "found #{count} records, wanted 4" unless count == 4 end step "clean up the system afterwards" - on agent, "mv -f #{backup} /etc/hosts" + on agent, "cat #{backup} > /etc/hosts && rm -f #{backup}" end