summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/resource/host/should_not_create_existing.rb
blob: a8f902286f96164cd903eaee14c4b4a9741e60ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
test_name "should not create host if it exists"

file = "/tmp/hosts-#{Time.new.to_i}"

step "set up the system for the test"
on agents, "printf '127.0.0.2 test alias\n' > #{file}"

step "tell puppet to ensure the host exists"
on(agents, puppet_resource('host', 'test', "target=#{file}",
              'ensure=present', 'ip=127.0.0.2', 'host_aliases=alias')) do
    fail_test "darn, we created the host record" if
        stdout.include? 'notice: /Host[test1]/ensure: created'
end

step "clean up after we created things"
on agents, "rm -f #{file}"