[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:31:58 UTC 2010
The following commit has been merged in the upstream branch:
commit 274d1c5e78250640b8d2c40201ca2586c0088f32
Author: Luke Kanies <luke at reductivelabs.com>
Date: Sat Jan 30 14:17:14 2010 -0600
Adding tmpfile cleanup to tests
Signed-off-by: Luke Kanies <luke at reductivelabs.com>
diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb
index 542ad6e..aad3740 100644
--- a/spec/lib/puppet_spec/files.rb
+++ b/spec/lib/puppet_spec/files.rb
@@ -1,9 +1,19 @@
+require 'fileutils'
+
# A support module for testing files.
module PuppetSpec::Files
def tmpfile(name)
source = Tempfile.new(name)
path = source.path
source.close!
+ $tmpfiles ||= []
+ $tmpfiles << path
path
end
+
+ def tmpdir(name)
+ file = tmpfile(name)
+ FileUtils.mkdir_p(file)
+ file
+ end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b57dab3..16081f9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -39,6 +39,20 @@ Spec::Runner.configure do |config|
config.prepend_after :each do
Puppet.settings.clear
Puppet::Node::Environment.clear
+
+ if defined?($tmpfiles)
+ $tmpfiles.each do |file|
+ unless file.include?("/tmp") or file.include?("/var/folders")
+ puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders"
+ next
+ end
+ if FileTest.exist?(file)
+ system("chmod -R 755 #{file}")
+ system("rm -rf #{file}")
+ end
+ end
+ $tmpfiles.clear
+ end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list