aboutsummaryrefslogtreecommitdiff
path: root/spec/acceptance/tests/destroy_spec.rb
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppet.com>2018-07-09 22:30:55 -0700
committerJosh Cooper <josh@puppet.com>2018-07-10 11:03:14 -0700
commitfa61bde37d75c0482d0a0d8822d635a1bc02662b (patch)
treedfcc296fe48ae82e3cb5674f1119ba8ebd4616f8 /spec/acceptance/tests/destroy_spec.rb
parent9c626516d265d7b3aa7bee08f23be6a36a3d8280 (diff)
downloadpuppet-hosts_core-fa61bde37d75c0482d0a0d8822d635a1bc02662b.tar.gz
puppet-hosts_core-fa61bde37d75c0482d0a0d8822d635a1bc02662b.tar.bz2
Rename beaker tests to end with _spec
Diffstat (limited to 'spec/acceptance/tests/destroy_spec.rb')
-rw-r--r--spec/acceptance/tests/destroy_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/acceptance/tests/destroy_spec.rb b/spec/acceptance/tests/destroy_spec.rb
new file mode 100644
index 0000000..f55c24b
--- /dev/null
+++ b/spec/acceptance/tests/destroy_spec.rb
@@ -0,0 +1,27 @@
+test_name 'should be able to remove a host record'
+
+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-destroy')
+ line = '127.0.0.7 test1'
+
+ step 'set up files for the test'
+ on agent, "printf '#{line}\n' > #{file}"
+
+ step 'delete the resource from the file'
+ on(agent, puppet_resource('host', 'test1', "target=#{file}",
+ 'ensure=absent', 'ip=127.0.0.7'))
+
+ step 'verify that the content was removed'
+ on(agent, "cat #{file}; rm -f #{file}") do
+ fail_test 'the content was still present' if stdout.include? line
+ end
+
+ step 'clean up after the test'
+ on agent, "rm -f #{file}"
+end