summaryrefslogtreecommitdiffstats
path: root/test/executables/puppetmodule.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-17 21:03:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-11-17 21:03:19 +0000
commit50821328ec637a4ec0feb822b86e208b04baae68 (patch)
tree3882a2c9a4264756b5b551dd6ba38cbd6ba41b52 /test/executables/puppetmodule.rb
parentc205bf6ba79a905c59eb99747ffe674bbaa11481 (diff)
downloadpuppet-50821328ec637a4ec0feb822b86e208b04baae68.tar.gz
puppet-50821328ec637a4ec0feb822b86e208b04baae68.tar.xz
puppet-50821328ec637a4ec0feb822b86e208b04baae68.zip
adding cfengine module, which required passing the cfengine classes all the way through the stack to the scope
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@746 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/executables/puppetmodule.rb')
-rwxr-xr-xtest/executables/puppetmodule.rb60
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$