test/executables/puppetmodule.rb in puppet-0.18.4 vs test/executables/puppetmodule.rb in puppet-0.22.4
- old
+ new
@@ -1,24 +1,22 @@
-if __FILE__ == $0
- $:.unshift '../../lib'
- $:.unshift '..'
- $puppetbase = "../.."
-end
+#!/usr/bin/env ruby
-require 'puppet'
-require 'puppet/server'
-require 'puppet/sslcertificates'
-require 'test/unit'
-require 'puppettest.rb'
+$:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
-$module = File.join($puppetbase, "ext", "module_puppet")
+require 'puppettest'
class TestPuppetModule < Test::Unit::TestCase
- include ExeTest
+ include PuppetTest::ExeTest
+
+ def setup
+ super
+ @module = File.join(basedir, "ext", "module_puppet")
+ end
+
def test_existence
- assert(FileTest.exists?($module), "Module does not exist")
+ assert(FileTest.exists?(@module), "Module does not exist")
end
def test_execution
file = tempfile()
@@ -27,29 +25,32 @@
File.open(file, "w") { |f|
f.puts "class yaytest { file { \"#{createdfile}\": ensure => file } }"
}
output = nil
- cmd = $module
+ cmd = @module
cmd += " --verbose"
#cmd += " --fqdn %s" % fqdn
cmd += " --confdir %s" % Puppet[:confdir]
cmd += " --vardir %s" % Puppet[:vardir]
if Puppet[:debug]
cmd += " --logdest %s" % "console"
cmd += " --debug"
+ cmd += " --trace"
else
cmd += " --logdest %s" % "/dev/null"
end
ENV["CFALLCLASSES"] = "yaytest:all"
+ libsetup
+ out = nil
assert_nothing_raised {
- %x{#{cmd + " " + file} 2>&1}
+ out = %x{#{cmd + " " + file} 2>&1}
}
- assert($? == 0, "Puppet module exited with code %s" % $?.to_i)
+ assert($? == 0, "Puppet module exited with code %s: %s" % [$?.to_i, out])
assert(FileTest.exists?(createdfile), "Failed to create config'ed file")
end
end
-# $Id: puppetmodule.rb 1256 2006-06-13 15:57:06Z luke $
+# $Id: puppetmodule.rb 2259 2007-03-06 19:03:05Z luke $