diff options
author | Josh Cooper <josh@puppet.com> | 2018-07-09 17:15:39 -0700 |
---|---|---|
committer | Josh Cooper <josh@puppet.com> | 2018-07-09 19:44:47 -0700 |
commit | 2ac89832b7e065df4490d81b3080b2b570a172ad (patch) | |
tree | f9f4f28f30a77c958e8e850acf954336b2301dc9 /spec/acceptance/tests/should_modify_alias.rb | |
parent | 1c6ae8bfde5175c5d3512f5acb5352fda94a4801 (diff) | |
download | puppet-hosts_core-2ac89832b7e065df4490d81b3080b2b570a172ad.tar.gz puppet-hosts_core-2ac89832b7e065df4490d81b3080b2b570a172ad.tar.bz2 |
Initial host import from puppet#ee7cf4d28077be7d1bdbbe934ea012d41d33deff
Diffstat (limited to 'spec/acceptance/tests/should_modify_alias.rb')
-rw-r--r-- | spec/acceptance/tests/should_modify_alias.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/acceptance/tests/should_modify_alias.rb b/spec/acceptance/tests/should_modify_alias.rb new file mode 100644 index 0000000..07198b1 --- /dev/null +++ b/spec/acceptance/tests/should_modify_alias.rb @@ -0,0 +1,27 @@ +test_name "should be able to modify a host alias" + +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-alias') + + step "set up files for the test" + on agent, "printf '127.0.0.8 test alias\n' > #{file}" + + step "modify the resource" + on(agent, puppet_resource('host', 'test', "target=#{file}", + 'ensure=present', 'ip=127.0.0.8', 'host_aliases=banzai')) + + step "verify that the content was updated" + on(agent, "cat #{file}; rm -f #{file}") do + fail_test "the alias was not updated" unless + stdout =~ /^127\.0\.0\.8[[:space:]]+test[[:space:]]+banzai[[:space:]]*$/ + end + + step "clean up after the test" + on agent, "rm -f #{file}" +end |