diff options
Diffstat (limited to 'test')
| -rwxr-xr-x | test/executables/puppetbin.rb | 5 | ||||
| -rwxr-xr-x | test/executables/puppetca.rb | 2 | ||||
| -rwxr-xr-x | test/executables/puppetd.rb | 2 | ||||
| -rwxr-xr-x | test/executables/puppetmodule.rb | 2 | ||||
| -rwxr-xr-x | test/language/ast.rb | 3 | ||||
| -rw-r--r-- | test/other/transactions.rb | 22 | ||||
| -rw-r--r-- | test/types/package.rb | 3 | ||||
| -rwxr-xr-x | test/types/symlink.rb | 3 |
8 files changed, 33 insertions, 9 deletions
diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb index 79fbd2358..bde9eaa8b 100755 --- a/test/executables/puppetbin.rb +++ b/test/executables/puppetbin.rb @@ -28,7 +28,6 @@ class TestPuppetBin < Test::Unit::TestCase if Puppet[:debug] cmd += " --debug" end - #cmd += " --fqdn %s" % fqdn cmd += " --confdir %s" % Puppet[:confdir] cmd += " --vardir %s" % Puppet[:vardir] unless Puppet[:debug] @@ -36,7 +35,7 @@ class TestPuppetBin < Test::Unit::TestCase end assert_nothing_raised { - system(cmd + " " + file) + output = %x{#{cmd + " " + file} 2>&1} } assert($? == 0, "Puppet exited with code %s" % $?.to_i) @@ -62,7 +61,7 @@ class TestPuppetBin < Test::Unit::TestCase cmd += " -e \"#{code}\"" assert_nothing_raised { - system(cmd) + out = %x{#{cmd} 2>&1} } assert($? == 0, "Puppet exited with code %s" % $?.to_i) diff --git a/test/executables/puppetca.rb b/test/executables/puppetca.rb index 1248e0345..b722c963f 100755 --- a/test/executables/puppetca.rb +++ b/test/executables/puppetca.rb @@ -29,7 +29,7 @@ class TestPuppetCA < Test::Unit::TestCase if Puppet[:debug] debug = "-d " end - return %x{puppetca --user=#{Puppet[:user]} #{debug} --group=#{Puppet[:group]} --confdir=#{Puppet[:confdir]} #{args} 2>&1} + return %x{puppetca --user=#{Puppet[:user]} #{debug} --group=#{Puppet[:group]} --confdir=#{Puppet[:confdir]} --vardir=#{Puppet[:vardir]} #{args} 2>&1} end diff --git a/test/executables/puppetd.rb b/test/executables/puppetd.rb index bae91dc7d..700ea5bd3 100755 --- a/test/executables/puppetd.rb +++ b/test/executables/puppetd.rb @@ -34,7 +34,7 @@ class TestPuppetDExe < Test::Unit::TestCase # and verify our daemon runs assert_nothing_raised { - system(cmd) + %x{#{cmd} 2>&1} } sleep 1 assert($? == 0, "Puppetd exited with code %s" % $?) diff --git a/test/executables/puppetmodule.rb b/test/executables/puppetmodule.rb index fcd85f42c..cff43a0e5 100755 --- a/test/executables/puppetmodule.rb +++ b/test/executables/puppetmodule.rb @@ -44,7 +44,7 @@ class TestPuppetModule < Test::Unit::TestCase ENV["CFALLCLASSES"] = "yaytest:all" assert_nothing_raised { - system(cmd + " " + file) + %x{#{cmd + " " + file} 2>&1} } assert($? == 0, "Puppet module exited with code %s" % $?.to_i) diff --git a/test/language/ast.rb b/test/language/ast.rb index 8860f4ad3..caa9cf156 100755 --- a/test/language/ast.rb +++ b/test/language/ast.rb @@ -247,8 +247,7 @@ class TestAST < Test::Unit::TestCase end assert(Puppet::Type.type(:file)["/#{name}"], "Could not find '#{name}'") end - - Puppet::Type.type(:file).clear + Puppet::Type.allclear end end diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 141d1d306..e898862e6 100644 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -330,4 +330,26 @@ class TestTransactions < Test::Unit::TestCase assert_events([:file_changed], comp) assert(FileTest.exists?(fname), "File did not get recreated") end + + def test_failed_reqs_mean_no_run + exec = Puppet::Type.type(:exec).create( + :command => "/bin/mkdir /this/path/cannot/possibly/exit", + :name => "mkdir" + ) + + file = Puppet::Type.type(:file).create( + :path => tempfile(), + :require => ["exec", "mkdir"], + :ensure => :file + ) + + comp = newcomp(exec, file) + + comp.finalize + + assert_apply(comp) + + assert(! FileTest.exists?(file[:path]), + "File got created even tho its dependency failed") + end end diff --git a/test/types/package.rb b/test/types/package.rb index 416754ce1..1c18fa628 100644 --- a/test/types/package.rb +++ b/test/types/package.rb @@ -285,6 +285,9 @@ class TestPackages < Test::Unit::TestCase assert_apply(pkg) pkg.retrieve assert(pkg.insync?, "Package does not think it's in sync") + + pkg[:ensure] = :absent + assert_apply(pkg) } end diff --git a/test/types/symlink.rb b/test/types/symlink.rb index ace726ac5..c44668448 100755 --- a/test/types/symlink.rb +++ b/test/types/symlink.rb @@ -41,6 +41,7 @@ class TestSymlink < Test::Unit::TestCase unless hash.include?(:ensure) hash[:ensure] = mktmpfile() end + link = Puppet.type(:symlink).create(hash) return link end @@ -73,7 +74,7 @@ class TestSymlink < Test::Unit::TestCase assert_nothing_raised { link = newlink(:ensure => source, :recurse => true) } - comp = newcomp("linktest",link) + comp = newcomp(link) cycle(comp) path = link.name |
