summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/executables/puppetbin.rb11
-rwxr-xr-xtest/executables/puppetca.rb15
-rwxr-xr-xtest/executables/puppetd.rb13
-rwxr-xr-xtest/executables/puppetmasterd.rb4
-rwxr-xr-xtest/executables/puppetmodule.rb11
-rw-r--r--test/puppettest.rb38
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 = "")