summaryrefslogtreecommitdiffstats
path: root/acceptance/tests
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-08-11 17:07:11 -0700
committerNick Lewis <nick@puppetlabs.com>2011-08-11 17:07:11 -0700
commit75786ada2187283f21241a5377908ff3a8b3d694 (patch)
treeb5f1649589c3bab518011c212ca8614bfb552472 /acceptance/tests
parentf7e96953b4e297ac1f78a1747e8dc3187c49870b (diff)
parentd7c9c765dbf28df3631e709832c44c343569cb53 (diff)
Merge pull request #32 from joshcooper/ticket/2.6.x/8740-cannot-manage-files-of-type-socket
Ticket/2.6.x/8740 cannot manage files of type socket
Diffstat (limited to 'acceptance/tests')
-rw-r--r--acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb b/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb
new file mode 100644
index 000000000..5763a3c98
--- /dev/null
+++ b/acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb
@@ -0,0 +1,32 @@
+test_name "#8740: should not enumerate root directory"
+
+target = "/test-socket-#{$$}"
+
+step "clean up the system before we begin"
+on(agents, "rm -f #{target}")
+
+step "create UNIX domain socket"
+on(agents, %Q{ruby -e "require 'socket'; UNIXServer::new('#{target}').close"})
+
+step "query for all files, which should return nothing"
+on(agents, puppet_resource('file'), :acceptable_exit_codes => [1]) do
+ assert_match(%r{Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc}, stderr)
+end
+
+["/", "/etc"].each do |file|
+ step "query '#{file}' directory, which should return single entry"
+ on(agents, puppet_resource('file', file)) do
+ files = stdout.scan(/^file \{ '([^']+)'/).flatten
+
+ assert_equal(1, files.size, "puppet returned multiple files: #{files.join(', ')}")
+ assert_match(file, files[0], "puppet did not return file")
+ end
+end
+
+step "query file that does not exist, which should report the file is absent"
+on(agents, puppet_resource('file', '/this/does/notexist')) do
+ assert_match(/ensure\s+=>\s+'absent'/, stdout)
+end
+
+step "remove UNIX domain socket"
+on(agents, "rm -f #{target}")