diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-29 20:16:28 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-29 20:16:28 +0000 |
| commit | 526deef2c44ac66edce85e18257f5341bd4ecb9c (patch) | |
| tree | 789e7012f50a95c65cc9ef81eec1353bf9ab0206 /test | |
| parent | 9e1c63a652f9b86af40c7de198f877bc09ad1c62 (diff) | |
| download | puppet-526deef2c44ac66edce85e18257f5341bd4ecb9c.tar.gz puppet-526deef2c44ac66edce85e18257f5341bd4ecb9c.tar.xz puppet-526deef2c44ac66edce85e18257f5341bd4ecb9c.zip | |
Fixed merging of state values, but I have not yet solved merging of parameter or metaparam values, since they are quite different.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@735 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/other/log.rb | 12 | ||||
| -rw-r--r-- | test/types/file.rb | 43 | ||||
| -rw-r--r-- | test/types/type.rb | 43 |
3 files changed, 62 insertions, 36 deletions
diff --git a/test/other/log.rb b/test/other/log.rb index f25b01149..0fd72887a 100644 --- a/test/other/log.rb +++ b/test/other/log.rb @@ -141,4 +141,16 @@ class TestLog < Test::Unit::TestCase assert_equal(log.tags, file.tags, "Tags were not equal") assert_equal(log.source, file.path, "Source was not set correctly") end + + # Verify that we can pass strings that match printf args + def test_percentlogs + Puppet[:logdest] = :syslog + + assert_nothing_raised { + Puppet::Log.new( + :level => :info, + :message => "A message with %s in it" + ) + } + end end diff --git a/test/types/file.rb b/test/types/file.rb index 4ff0705c0..b160ae1da 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -32,12 +32,12 @@ class TestFile < Test::Unit::TestCase end def setup + super begin initstorage rescue system("rm -rf %s" % Puppet[:checksumfile]) end - super end def teardown @@ -192,14 +192,15 @@ class TestFile < Test::Unit::TestCase assert(file.insync?()) } - fake.each { |uid, name| - assert_raise(Puppet::Error) { - file[:owner] = name - } - assert_raise(Puppet::Error) { - file[:owner] = uid - } - } + # We no longer raise an error here, because we check at run time + #fake.each { |uid, name| + # assert_raise(Puppet::Error) { + # file[:owner] = name + # } + # assert_raise(Puppet::Error) { + # file[:owner] = uid + # } + #} end def test_groupasroot @@ -518,30 +519,6 @@ class TestFile < Test::Unit::TestCase file.sync } end - - if Process.uid == 0 - def test_zfilewithpercentsign - file = nil - dir = tmpdir() - path = File.join(dir, "file%sname") - assert_nothing_raised { - file = Puppet::Type::PFile.create( - :path => path, - :create => true, - :owner => "nosuchuser", - :group => "root", - :mode => "755" - ) - } - - comp = newcomp("percent", file) - events = nil - assert_nothing_raised { - trans = comp.evaluate - events = trans.evaluate - } - end - end end # $Id$ diff --git a/test/types/type.rb b/test/types/type.rb index 4347ea0b0..55b809372 100644 --- a/test/types/type.rb +++ b/test/types/type.rb @@ -1,11 +1,9 @@ if __FILE__ == $0 $:.unshift '..' $:.unshift '../../lib' - $puppetbase = "../../../../language/trunk" + $puppetbase = "../.." end -# $Id$ - require 'puppet/type' require 'puppettest' require 'test/unit' @@ -111,4 +109,43 @@ class TestType < Test::Unit::TestCase assert_equal("testing", group.name, "Could not retrieve name") end + + # Verify that values get merged correctly + def test_mergestatevalues + file = tempfile() + + # Create the first version + assert_nothing_raised { + Puppet::Type::PFile.create( + :path => file, + :owner => ["root", "bin"] + ) + } + + # Make an identical statement + assert_nothing_raised { + Puppet::Type::PFile.create( + :path => file, + :owner => ["root", "bin"] + ) + } + + # Create a conflicting statement + assert_raise(Puppet::Error) { + Puppet::Type::PFile.create( + :path => file, + :owner => ["root", "bin", "adm"] + ) + } + + # And then make an intersection with one valid value + assert_nothing_raised { + Puppet::Type::PFile.create( + :path => file, + :owner => "root" + ) + } + end end + +# $Id$ |
