summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-28 23:28:22 -0700
committerLuke Kanies <luke@madstop.com>2008-08-28 23:28:22 -0700
commit93fc1139550bd97a11529b812e77ac0fc00c6079 (patch)
tree66ef90dc4dcfa02c012307f80d84a2b194877d9d /spec/integration
parentbd1163a339ff66dbb9a50a1cb13f6320cb056cc3 (diff)
downloadpuppet-93fc1139550bd97a11529b812e77ac0fc00c6079.tar.gz
puppet-93fc1139550bd97a11529b812e77ac0fc00c6079.tar.xz
puppet-93fc1139550bd97a11529b812e77ac0fc00c6079.zip
Files now use the Indirector to recurse locally.
I don't yet have integration tests for remote recursion or link recursion, but we're nearly there. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/type/file.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb
new file mode 100755
index 000000000..39d0b62dc
--- /dev/null
+++ b/spec/integration/type/file.rb
@@ -0,0 +1,53 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Puppet::Type.type(:file), "when recursing" do
+ def mkdir
+ end
+
+ def build_path(dir)
+ Dir.mkdir(dir)
+ File.chmod(0750, dir)
+
+ @dirs = [dir]
+ @files = []
+
+ %w{one two}.each do |subdir|
+ fdir = File.join(dir, subdir)
+ Dir.mkdir(fdir)
+ File.chmod(0750, fdir)
+ @dirs << fdir
+
+ %w{three}.each do |file|
+ ffile = File.join(fdir, file)
+ @files << ffile
+ File.open(ffile, "w") { |f| f.puts "test %s" % file }
+ File.chmod(0640, ffile)
+ end
+ end
+ end
+
+ it "should be able to recursively set properties on existing files" do
+ @path = Tempfile.new("file_integration_tests")
+ @path.close!()
+ @path = @path.path
+
+ build_path(@path)
+
+ @file = Puppet::Type::File.create(:name => @path, :mode => 0644, :recurse => true)
+
+ @catalog = Puppet::Node::Catalog.new
+ @catalog.add_resource @file
+
+ @catalog.apply
+
+ @dirs.each do |path|
+ (File.stat(path).mode & 007777).should == 0755
+ end
+
+ @files.each do |path|
+ (File.stat(path).mode & 007777).should == 0644
+ end
+ end
+end