1
test_name "should not run command creates"
3
touch = "/tmp/touched-#{Time.new.to_i}"
4
donottouch = "/tmp/not-touched-#{Time.new.to_i}"
7
exec { "test#{Time.new.to_i}": command => '/bin/touch #{donottouch}', creates => "#{touch}"}
10
step "prepare the agents for the test"
11
on agents, "touch #{touch} ; rm -f #{donottouch}"
13
step "test using puppet apply"
14
apply_manifest_on(agents, manifest) do
15
fail_test "looks like the thing executed, which it shouldn't" if
16
stdout.include? 'executed successfully'
19
step "verify the file didn't get created"
20
on agents, "test -f #{donottouch}", :acceptable_exit_codes => [1]
22
step "prepare the agents for the second part of the test"
23
on agents, "touch #{touch} ; rm -f #{donottouch}"
25
step "test using puppet resource"
26
on(agents, puppet_resource('exec', "test#{Time.new.to_i}",
27
"command='/bin/touch #{donottouch}'",
28
"creates='#{touch}'")) do
29
fail_test "looks like the thing executed, which it shouldn't" if
30
stdout.include? 'executed successfully'
33
step "verify the file didn't get created the second time"
34
on agents, "test -f #{donottouch}", :acceptable_exit_codes => [1]