diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-12 05:02:51 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-12 05:02:51 +0000 |
| commit | 4c4f530bb5f81ab793e93b5034bddd89f3ec677e (patch) | |
| tree | 2c7e47caf190914c8941d23c77b9e9f26da0a9d1 /test | |
| parent | 21410a2152d03d8a7f52bebcdf52666e77a0dbfa (diff) | |
Fixing dependencies to not depend on file order. Added Puppet::Type.{finalize,mkdepends,builddepends}
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@808 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/events.rb | 2 | ||||
| -rwxr-xr-x | test/other/relationships.rb | 2 | ||||
| -rwxr-xr-x | test/types/component.rb | 6 | ||||
| -rwxr-xr-x | test/types/cron.rb | 12 | ||||
| -rwxr-xr-x | test/types/exec.rb | 6 | ||||
| -rw-r--r-- | test/types/file.rb | 1 | ||||
| -rw-r--r-- | test/types/type.rb | 28 |
7 files changed, 49 insertions, 8 deletions
diff --git a/test/other/events.rb b/test/other/events.rb index 911180b28..f57fd3272 100755 --- a/test/other/events.rb +++ b/test/other/events.rb @@ -98,6 +98,8 @@ class TestEvents < Test::Unit::TestCase comps[:b][:subscribe] = [[comps[:a].class.name, comps[:a].name]] + Puppet::Type.finalize + trans = comps[:a].evaluate events = nil assert_nothing_raised { diff --git a/test/other/relationships.rb b/test/other/relationships.rb index f2764c639..3decfd5af 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -26,6 +26,8 @@ class TestRelationships < Test::Unit::TestCase file1[:require] = [file2.class.name, file2.name] } + Puppet::Type.finalize + deps = [] assert_nothing_raised { file1.eachdependency { |obj| diff --git a/test/types/component.rb b/test/types/component.rb index b97695f9f..83da95a56 100755 --- a/test/types/component.rb +++ b/test/types/component.rb @@ -22,7 +22,7 @@ class TestComponent < Test::Unit::TestCase looped = 0 loop do looped += 1 - if looped > 1000 + if looped > 2000 raise "Reached limit of looping" break end @@ -89,6 +89,7 @@ class TestComponent < Test::Unit::TestCase comp.push obj } + Puppet::Type.finalize comp end @@ -158,6 +159,7 @@ class TestComponent < Test::Unit::TestCase ) } + Puppet::Type.finalize comp = Puppet.type(:component).create(:name => "RefreshTest") [cmd, file].each { |obj| comp.push obj @@ -202,6 +204,7 @@ class TestComponent < Test::Unit::TestCase ecomp[:subscribe] = [[fcomp.class.name,fcomp.name]] comp = newcomp("bflatten", ecomp, fcomp) + Puppet::Type.finalize objects = nil assert_nothing_raised { objects = comp.flatten @@ -254,6 +257,7 @@ class TestComponent < Test::Unit::TestCase ocmd[:subscribe] = [[cmd.class.name,cmd.name]] comp = newcomp("bflatten", ocomp, ecomp, fcomp) + Puppet::Type.finalize objects = nil assert_nothing_raised { objects = comp.flatten diff --git a/test/types/cron.rb b/test/types/cron.rb index 3ff1dbd18..4bf0ab6b7 100755 --- a/test/types/cron.rb +++ b/test/types/cron.rb @@ -14,11 +14,11 @@ require 'facter' # Here we just want to unit-test our cron type, to verify that -class TestCronType < Test::Unit::TestCase - include TestPuppet - - -end +#class TestCronType < Test::Unit::TestCase +# include TestPuppet +# +# +#end class TestCron < Test::Unit::TestCase include TestPuppet @@ -256,7 +256,7 @@ class TestCron < Test::Unit::TestCase def test_mkcronwithtab Puppet.type(:cron).crontype.remove(@me) Puppet.type(:cron).crontype.write(@me, -"1 1 1 1 * date > %s/crontesting\n" % testdir() +"1 1 1 1 * date > %s/crontesting\n" % tstdir() ) cron = mkcron("testwithtab") diff --git a/test/types/exec.rb b/test/types/exec.rb index 446865774..370fe380f 100755 --- a/test/types/exec.rb +++ b/test/types/exec.rb @@ -243,14 +243,17 @@ class TestExec < Test::Unit::TestCase exec = Puppet.type(:exec).create( :name => oexe, + :path => ENV["PATH"], :cwd => basedir ) cat = Puppet.type(:exec).create( - :name => "cat %s" % oexe, + :name => "cat %s %s" % [exe, oexe], :path => ENV["PATH"] ) + Puppet::Type.finalize + # Verify we get the script itself assert(exec.requires?(file), "Exec did not autorequire file") @@ -261,6 +264,7 @@ class TestExec < Test::Unit::TestCase assert(!exec.requires?(ofile), "Exec incorrectly required file") # Verify that we catch inline files + assert(cat.requires?(ofile), "Exec did not catch second inline file") assert(cat.requires?(file), "Exec did not catch inline file") end diff --git a/test/types/file.rb b/test/types/file.rb index 93332e06a..4aee2a4e9 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -581,6 +581,7 @@ class TestFile < Test::Unit::TestCase :create => "file" ) + Puppet::Type.finalize assert(subobj.requires?(baseobj), "File did not require basedir") assert(!subobj.requires?(subobj), "File required itself") comp = newcomp(subobj, baseobj) diff --git a/test/types/type.rb b/test/types/type.rb index 7a95e2574..fd551c4fd 100644 --- a/test/types/type.rb +++ b/test/types/type.rb @@ -153,6 +153,34 @@ class TestType < Test::Unit::TestCase "Could not retrieve alias") end + + # Verify that requirements don't depend on file order + def test_prereqorder + one = tempfile() + two = tempfile() + + twoobj = nil + oneobj = nil + assert_nothing_raised("Could not create prereq that doesn't exist yet") { + twoobj = Puppet.type(:file).create( + :name => two, + :require => [:file, one] + ) + } + + assert_nothing_raised { + oneobj = Puppet.type(:file).create( + :name => one + ) + } + + assert_nothing_raised { + Puppet::Type.finalize + } + + + assert(twoobj.requires?(oneobj), "Requirement was not created") + end end # $Id$ |
