summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/resource/file/should_create_symlink.rb
blob: 81fe4b4e3ba58b212f8410653c4d241ed37f0b29 (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
test_name "should create symlink"

message = 'hello world'
target  = "/tmp/test-#{Time.new.to_i}"
source  = "/tmp/test-#{Time.new.to_i}-source"

step "clean up the system before we begin"
on agents, "rm -rf #{target}"
on agents, "echo '#{message}' > #{source}"

step "verify we can create a symlink"
on(agents, puppet_resource("file", target, "ensure=#{source}"))

step "verify the symlink was created"
on agents, "test -L #{target} && test -f #{target}"
step "verify source file"
on agents, "test -f #{source}"

step "verify the content is identical on both sides"
on(agents, "cat #{source}") do
    fail_test "source missing content" unless stdout.include? message
end
on(agents, "cat #{target}") do
    fail_test "target missing content" unless stdout.include? message
end

step "clean up after the test run"
on agents, "rm -rf #{target} #{source}"