From d8b4b0dbf35b2b183cd62adf591ebf4650448a0d Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 4 Apr 2006 22:23:08 +0000 Subject: adding -e ability to puppet executable git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1065 980ebf18-57e1-0310-9a29-db15c13687c0 --- test/executables/puppetbin.rb | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'test/executables') diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb index d787a704d..79fbd2358 100755 --- a/test/executables/puppetbin.rb +++ b/test/executables/puppetbin.rb @@ -22,7 +22,6 @@ class TestPuppetBin < Test::Unit::TestCase def test_execution file = mktestmanifest() - @@tmpfiles << tempfile() output = nil cmd = "puppet" @@ -32,7 +31,9 @@ class TestPuppetBin < Test::Unit::TestCase #cmd += " --fqdn %s" % fqdn cmd += " --confdir %s" % Puppet[:confdir] cmd += " --vardir %s" % Puppet[:vardir] - cmd += " --logdest %s" % "/dev/null" + unless Puppet[:debug] + cmd += " --logdest %s" % "/dev/null" + end assert_nothing_raised { system(cmd + " " + file) @@ -41,6 +42,32 @@ class TestPuppetBin < Test::Unit::TestCase assert(FileTest.exists?(@createdfile), "Failed to create config'ed file") end + + def test_inlineexecution + path = tempfile() + code = "file { '#{path}': ensure => file }" + + output = nil + cmd = "puppet" + if Puppet[:debug] + cmd += " --debug" + end + #cmd += " --fqdn %s" % fqdn + cmd += " --confdir %s" % Puppet[:confdir] + cmd += " --vardir %s" % Puppet[:vardir] + unless Puppet[:debug] + cmd += " --logdest %s" % "/dev/null" + end + + cmd += " -e \"#{code}\"" + + assert_nothing_raised { + system(cmd) + } + assert($? == 0, "Puppet exited with code %s" % $?.to_i) + + assert(FileTest.exists?(path), "Failed to create config'ed file") + end end -# $Id: $ +# $Id$ -- cgit