diff options
author | Luke Kanies <luke@madstop.com> | 2009-06-14 19:27:30 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-06-14 19:27:30 -0500 |
commit | ed876e0264bbb1ba86bc302d517d8f48f388da3e (patch) | |
tree | 3ff70b82002c608deb2a3bd66e5b8d0f272d6ccf /test | |
parent | bd81c25b4072c3426af67e0366b18436c8236dc4 (diff) | |
download | puppet-ed876e0264bbb1ba86bc302d517d8f48f388da3e.tar.gz puppet-ed876e0264bbb1ba86bc302d517d8f48f388da3e.tar.xz puppet-ed876e0264bbb1ba86bc302d517d8f48f388da3e.zip |
Refactoring part of the file/filebucket integration
The goal of this commit is to fix ordering issues
that could result when the filebuckets are added
to the catalog after the resources that use them.
This condition showed up somewhat arbitrarily.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/ral/type/file.rb | 63 |
1 files changed, 5 insertions, 58 deletions
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 8db306c32..829310ed4 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -577,7 +577,8 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( :name => dest, :checksum => "md5", - :content => "This is some content" + :content => "This is some content", + :backup => false ) } @@ -726,7 +727,8 @@ class TestFile < Test::Unit::TestCase assert_nothing_raised { file = Puppet::Type.type(:file).new( :ensure => path, - :path => link + :path => link, + :backup => false ) } @@ -981,51 +983,6 @@ class TestFile < Test::Unit::TestCase assert_equal(:false, file[:replace], ":replace did not alias :false to :no") end - def test_backup - path = tempfile() - file = Puppet::Type.newfile :path => path, :content => "yay" - - catalog = mk_catalog(file) - catalog.finalize # adds the default resources. - - [false, :false, "false"].each do |val| - assert_nothing_raised do - file[:backup] = val - end - assert_equal(false, file[:backup], "%s did not translate" % val.inspect) - end - [true, :true, "true", ".puppet-bak"].each do |val| - assert_nothing_raised do - file[:backup] = val - end - assert_equal(".puppet-bak", file[:backup], "%s did not translate" % val.inspect) - end - - # Now try a non-bucket string - assert_nothing_raised do - file[:backup] = ".bak" - end - assert_equal(".bak", file[:backup], ".bak did not translate") - - # Now try a non-existent bucket - assert_nothing_raised do - file[:backup] = "main" - end - assert_equal("main", file[:backup], "bucket name was not retained") - assert_equal("main", file.bucket, "file's bucket was not set") - - # And then an existing bucket - obj = Puppet::Type.type(:filebucket).new :name => "testing" - catalog.add_resource(obj) - bucket = obj.bucket - - assert_nothing_raised do - file[:backup] = "testing" - end - assert_equal("testing", file[:backup], "backup value was reset") - assert_equal(obj.bucket, file.bucket, "file's bucket was not set") - end - def test_pathbuilder dir = tempfile() Dir.mkdir(dir) @@ -1047,7 +1004,7 @@ class TestFile < Test::Unit::TestCase def test_removal_with_content_set path = tempfile() File.open(path, "w") { |f| f.puts "yay" } - file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo") + file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo", :backup => false) assert_apply(file) assert(! FileTest.exists?(path), "File was not removed") @@ -1125,16 +1082,6 @@ class TestFile < Test::Unit::TestCase end end - # Make sure we default to the "puppet" filebucket, rather than a string - def test_backup_defaults_to_bucket - path = tempfile - file = Puppet::Type.newfile(:path => path, :content => 'some content') - file.finish - - assert_instance_of(Puppet::Network::Client::Dipper, file.bucket, - "did not default to a filebucket for backups") - end - # #567 def test_missing_files_are_in_sync file = tempfile |