diff options
Diffstat (limited to 'test/executables/puppetmodule.rb')
| -rwxr-xr-x | test/executables/puppetmodule.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/executables/puppetmodule.rb b/test/executables/puppetmodule.rb new file mode 100755 index 000000000..ba356f6cc --- /dev/null +++ b/test/executables/puppetmodule.rb @@ -0,0 +1,60 @@ +if __FILE__ == $0 + $:.unshift '../../lib' + $:.unshift '..' + $puppetbase = "../.." +end + +require 'puppet' +require 'puppet/server' +require 'puppet/sslcertificates' +require 'test/unit' +require 'puppettest.rb' + +# add the bin directory to our search path +ENV["PATH"] += ":" + File.join($puppetbase, "bin") + +# and then the library directories +libdirs = $:.find_all { |dir| + dir =~ /puppet/ or dir =~ /\.\./ +} +ENV["RUBYLIB"] = libdirs.join(":") + +$module = File.join($puppetbase, "ext", "module:puppet") + +class TestPuppetModule < Test::Unit::TestCase + include ServerTest + + def test_execution + file = tempfile() + + createdfile = tempfile() + + File.open(file, "w") { |f| + f.puts "class yaytest { file { \"#{createdfile}\": create => true } }" + } + + output = nil + cmd = $module + cmd += " --verbose" + #cmd += " --fqdn %s" % fqdn + cmd += " --confdir %s" % Puppet[:puppetconf] + cmd += " --vardir %s" % Puppet[:puppetvar] + if Puppet[:debug] + cmd += " --logdest %s" % "console" + else + cmd += " --logdest %s" % "/dev/null" + end + + ENV["CFALLCLASSES"] = "yaytest:all" + + Puppet.err :mark + assert_nothing_raised { + system(cmd + " " + file) + } + assert($? == 0, "Puppet module exited with code %s" % $?.to_i) + + assert(FileTest.exists?(createdfile), "Failed to create config'ed file") + end +end + +# $Id$ |
