diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-10 00:10:14 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-10 00:10:14 +0000 |
commit | e5ac19668867a8adeb18066bdd1d3e201e38211c (patch) | |
tree | 64c599f45ff10ba39caf7adeef0ee8afd651373a | |
parent | dccafc7e950d9111a0a4c11afebd89e1ede5e414 (diff) | |
download | puppet-e5ac19668867a8adeb18066bdd1d3e201e38211c.tar.gz puppet-e5ac19668867a8adeb18066bdd1d3e201e38211c.tar.xz puppet-e5ac19668867a8adeb18066bdd1d3e201e38211c.zip |
Adding some consistencies to the executable tests. All exe tests now pass on OpenBSD, although the only real problem was that ruby was in /usr/local/bin.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@795 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-x | test/executables/puppetbin.rb | 11 | ||||
-rwxr-xr-x | test/executables/puppetca.rb | 15 | ||||
-rwxr-xr-x | test/executables/puppetd.rb | 13 | ||||
-rwxr-xr-x | test/executables/puppetmasterd.rb | 4 | ||||
-rwxr-xr-x | test/executables/puppetmodule.rb | 11 | ||||
-rw-r--r-- | test/puppettest.rb | 38 |
6 files changed, 41 insertions, 51 deletions
diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb index f16ccbbf2..9fb4dbd11 100755 --- a/test/executables/puppetbin.rb +++ b/test/executables/puppetbin.rb @@ -10,17 +10,8 @@ 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(":") - class TestPuppetBin < Test::Unit::TestCase - include ServerTest + include ExeTest def test_version output = nil assert_nothing_raised { diff --git a/test/executables/puppetca.rb b/test/executables/puppetca.rb index 819ecf702..b69edb314 100755 --- a/test/executables/puppetca.rb +++ b/test/executables/puppetca.rb @@ -10,19 +10,8 @@ require 'puppet/sslcertificates' require 'test/unit' require 'puppettest.rb' -# $Id$ - -# ok, we have to 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(":") - class TestPuppetCA < Test::Unit::TestCase - include ServerTest + include ExeTest def mkcert(hostname) cert = nil assert_nothing_raised { @@ -77,3 +66,5 @@ class TestPuppetCA < Test::Unit::TestCase assert_equal([], output) end end + +# $Id$ diff --git a/test/executables/puppetd.rb b/test/executables/puppetd.rb index 547405779..68b9b5f08 100755 --- a/test/executables/puppetd.rb +++ b/test/executables/puppetd.rb @@ -11,17 +11,6 @@ require 'puppettest.rb' require 'socket' require 'facter' -# $Id$ - -# ok, we have to 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(":") - class TestPuppetDExe < Test::Unit::TestCase include ExeTest def test_normalstart @@ -69,3 +58,5 @@ class TestPuppetDExe < Test::Unit::TestCase stopmasterd end end + +# $Id$ diff --git a/test/executables/puppetmasterd.rb b/test/executables/puppetmasterd.rb index a80190d00..ee47bd557 100755 --- a/test/executables/puppetmasterd.rb +++ b/test/executables/puppetmasterd.rb @@ -12,8 +12,6 @@ require 'puppettest.rb' require 'socket' require 'facter' -# $Id$ - class TestPuppetMasterD < Test::Unit::TestCase include ExeTest def getcerts @@ -151,3 +149,5 @@ class TestPuppetMasterD < Test::Unit::TestCase #stopmasterd end end + +# $Id$ diff --git a/test/executables/puppetmodule.rb b/test/executables/puppetmodule.rb index 429e29e36..c0020779d 100755 --- a/test/executables/puppetmodule.rb +++ b/test/executables/puppetmodule.rb @@ -10,19 +10,10 @@ 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 + include ExeTest def test_existence assert(FileTest.exists?($module), "Module does not exist") diff --git a/test/puppettest.rb b/test/puppettest.rb index 5cc3287e9..237b81aac 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -312,15 +312,41 @@ end module ExeTest include ServerTest - unless ENV["PATH"] =~ /puppet/ - # ok, we have to add the bin directory to our search path - ENV["PATH"] += ":" + File.join($puppetbase, "bin") - # and then the library directories - libdirs = $:.find_all { |dir| + def setup + super + setbindir + setlibdir + end + + def bindir + File.join($puppetbase, "bin") + end + + def setbindir + unless ENV["PATH"] =~ /puppet/ + ENV["PATH"] += ":" + bindir + end + end + + def setlibdir + ENV["RUBYLIB"] = $:.find_all { |dir| dir =~ /puppet/ or dir =~ /\.\./ + }.join(":") + end + + # Run a ruby command. This explicitly uses ruby to run stuff, since we + # don't necessarily know where our ruby binary is, dernit. + # Currently unused, because I couldn't get it to work. + def rundaemon(*cmd) + @ruby ||= %x{which ruby}.chomp + cmd = cmd.unshift(@ruby).join(" ") + + out = nil + Dir.chdir(bindir()) { + out = %x{#{@ruby} #{cmd}} } - ENV["RUBYLIB"] = libdirs.join(":") + return out end def startmasterd(args = "") |