diff options
author | Josh Cooper <josh@puppet.com> | 2018-07-09 22:30:55 -0700 |
---|---|---|
committer | Josh Cooper <josh@puppet.com> | 2018-07-10 11:03:14 -0700 |
commit | fa61bde37d75c0482d0a0d8822d635a1bc02662b (patch) | |
tree | dfcc296fe48ae82e3cb5674f1119ba8ebd4616f8 /spec/acceptance/tests/modify_ip_spec.rb | |
parent | 9c626516d265d7b3aa7bee08f23be6a36a3d8280 (diff) | |
download | puppet-hosts_core-fa61bde37d75c0482d0a0d8822d635a1bc02662b.tar.gz puppet-hosts_core-fa61bde37d75c0482d0a0d8822d635a1bc02662b.tar.bz2 |
Rename beaker tests to end with _spec
Diffstat (limited to 'spec/acceptance/tests/modify_ip_spec.rb')
-rw-r--r-- | spec/acceptance/tests/modify_ip_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/acceptance/tests/modify_ip_spec.rb b/spec/acceptance/tests/modify_ip_spec.rb new file mode 100644 index 0000000..22019b7 --- /dev/null +++ b/spec/acceptance/tests/modify_ip_spec.rb @@ -0,0 +1,27 @@ +test_name 'should be able to modify a host address' + +tag 'audit:low', + 'audit:refactor', # Use block style `test_name` + 'audit:acceptance' # Could be done at the integration (or unit) layer though +# actual changing of resources could irreparably damage a +# host running this, or require special permissions. + +agents.each do |agent| + file = agent.tmpfile('host-modify-ip') + + step 'set up files for the test' + on agent, "printf '127.0.0.9 test alias\n' > #{file}" + + step 'modify the resource' + on(agent, puppet_resource('host', 'test', "target=#{file}", + 'ensure=present', 'ip=127.0.0.10', 'host_aliases=alias')) + + step 'verify that the content was updated' + on(agent, "cat #{file}; rm -f #{file}") do + fail_test 'the address was not updated' unless + stdout =~ %r{^127\.0\.0\.10[[:space:]]+test[[:space:]]+alias[[:space:]]*$} + end + + step 'clean up after the test' + on agent, "rm -f #{file}" +end |