diff options
| author | Luke Kanies <luke@madstop.com> | 2008-08-29 00:48:40 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-08-29 00:48:40 -0700 |
| commit | 45f465bc98aa87e1066a9d748dbb6bfaaef61476 (patch) | |
| tree | 79338acb1527888382256f48126a0514941164d6 /spec/integration | |
| parent | 93fc1139550bd97a11529b812e77ac0fc00c6079 (diff) | |
| download | puppet-45f465bc98aa87e1066a9d748dbb6bfaaef61476.tar.gz puppet-45f465bc98aa87e1066a9d748dbb6bfaaef61476.tar.xz puppet-45f465bc98aa87e1066a9d748dbb6bfaaef61476.zip | |
Source recursion is nearly working.
It works, but you have to run it multiple times,
and there are still a couple of strangenesses with the
parameter values, such as the mode not getting set on
the first run.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration')
| -rwxr-xr-x | spec/integration/type/file.rb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb index 39d0b62dc..b59fa3294 100755 --- a/spec/integration/type/file.rb +++ b/spec/integration/type/file.rb @@ -28,6 +28,19 @@ describe Puppet::Type.type(:file), "when recursing" do end end + it "should be able to recurse over a nonexistent file" do + @path = Tempfile.new("file_integration_tests") + @path.close!() + @path = @path.path + + @file = Puppet::Type::File.create(:name => @path, :mode => 0644, :recurse => true) + + @catalog = Puppet::Node::Catalog.new + @catalog.add_resource @file + + lambda { @file.eval_generate }.should_not raise_error + end + it "should be able to recursively set properties on existing files" do @path = Tempfile.new("file_integration_tests") @path.close!() @@ -50,4 +63,66 @@ describe Puppet::Type.type(:file), "when recursing" do (File.stat(path).mode & 007777).should == 0644 end end + + it "should be able to recursively make links to other files" do + source = Tempfile.new("file_link_integration_source") + source.close!() + source = source.path + + build_path(source) + + dest = Tempfile.new("file_link_integration_dest") + dest.close!() + dest = dest.path + + @file = Puppet::Type::File.create(:name => dest, :target => source, :recurse => true, :ensure => :link) + + @catalog = Puppet::Node::Catalog.new + @catalog.add_resource @file + + @catalog.apply + + @dirs.each do |path| + link_path = path.sub(source, dest) + + File.lstat(link_path).should be_directory + end + + @files.each do |path| + link_path = path.sub(source, dest) + + File.lstat(link_path).ftype.should == "link" + end + end + + it "should be able to recursively copy files" do + source = Tempfile.new("file_source_integration_source") + source.close!() + source = source.path + + build_path(source) + + dest = Tempfile.new("file_source_integration_dest") + dest.close!() + dest = dest.path + + @file = Puppet::Type::File.create(:name => dest, :source => source, :recurse => true) + + @catalog = Puppet::Node::Catalog.new + @catalog.add_resource @file + + @catalog.apply + + @dirs.each do |path| + newpath = path.sub(source, dest) + + File.lstat(newpath).should be_directory + end + + @files.each do |path| + newpath = path.sub(source, dest) + + File.lstat(newpath).ftype.should == "file" + end + end end |
