summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/resource/exec/should_run_command.rb
blob: b7156c6c9c3d98a21cf1823faccf3bf4d58c2656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
test_name "tests that puppet correctly runs an exec."
# original author: Dan Bode  --daniel 2010-12-23

$touch = "/tmp/test-exec-#{Time.new.to_i}"

def before
    step "file to be touched should not exist."
    on agents, "rm -f #{$touch}"
end

def after
    step "checking the output worked"
    on agents, "test -f #{$touch}"

    step "clean up the system"
    on agents, "rm -f #{$touch}"
end

before
apply_manifest_on(agents, "exec {'test': command=>'/bin/touch #{$touch}'}") do
    fail_test "didn't seem to run the command" unless
        stdout.include? 'executed successfully'
end
after

before
on(agents, puppet_resource('-d', 'exec', 'test', "command='/bin/touch #{$touch}'")) do
    fail_test "didn't seem to run the command" unless
        stdout.include? 'executed successfully'
end
after