diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-11 00:48:21 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-11 00:48:21 +0000 |
| commit | 89d00506efe28631921feea072cd5773e18b3a37 (patch) | |
| tree | e6eda7c4df36543730b91999cfb75e41c5985d96 /test | |
| parent | 45ac512054af7cb8104cfa785102b67164d2cca4 (diff) | |
Adding Sun support and fixing the last remaining bugs related to the daemon changes i just made
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@799 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/executables/puppetmasterd.rb | 2 | ||||
| -rw-r--r-- | test/puppettest.rb | 10 | ||||
| -rw-r--r-- | test/types/package.rb | 81 |
3 files changed, 60 insertions, 33 deletions
diff --git a/test/executables/puppetmasterd.rb b/test/executables/puppetmasterd.rb index ee47bd557..389141ed0 100755 --- a/test/executables/puppetmasterd.rb +++ b/test/executables/puppetmasterd.rb @@ -27,7 +27,7 @@ class TestPuppetMasterD < Test::Unit::TestCase def test_normalstart startmasterd - pidfile = File.join(Puppet[:puppetvar], "puppetmasterd.pid") + pidfile = File.join(Puppet[:puppetvar], "run", "puppetmasterd.pid") assert(FileTest.exists?(pidfile), "PID file does not exist") sleep(1) diff --git a/test/puppettest.rb b/test/puppettest.rb index 237b81aac..202d57478 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -357,17 +357,23 @@ module ExeTest args += " --confdir %s" % Puppet[:puppetconf] args += " --vardir %s" % Puppet[:puppetvar] args += " --port %s" % @@port + args += " --user %s" % Process.uid + args += " --group %s" % Process.gid args += " --nonodes" args += " --autosign" + #if Puppet[:debug] + # args += " --debug" + #end + cmd = "puppetmasterd %s" % args assert_nothing_raised { output = %x{#{cmd}}.chomp } - assert($? == 0, "Puppetmasterd exit status was %s" % $?) assert_equal("", output, "Puppetmasterd produced output %s" % output) + assert($? == 0, "Puppetmasterd exit status was %s" % $?) sleep(1) return manifest @@ -376,7 +382,7 @@ module ExeTest def stopmasterd(running = true) ps = Facter["ps"].value || "ps -ef" - pidfile = File.join(Puppet[:puppetvar], "puppetmasterd.pid") + pidfile = File.join(Puppet[:puppetvar], "run", "puppetmasterd.pid") pid = nil if FileTest.exists?(pidfile) diff --git a/test/types/package.rb b/test/types/package.rb index 908aa52bd..0c67646e0 100644 --- a/test/types/package.rb +++ b/test/types/package.rb @@ -51,19 +51,46 @@ class TestPackages < Test::Unit::TestCase return pkgs end - def tstpkg + def mkpkgs + tstpkgs().each { |pkg| + if pkg.is_a?(Array) + hash = {:name => pkg[0], :source => pkg[1]} + hash[:install] = "true" + + unless File.exists?(hash[:source]) + Puppet.info "No package file %s for %s; skipping some package tests" % + [hash[:source], Facter["operatingsystem"].value] + end + yield Puppet.type(:package).create(hash) + else + yield Puppet.type(:package).create( + :name => pkg, :install => "latest" + ) + end + } + end + + def tstpkgs + retval = [] case $platform - #when "SunOS" - # type = "sunpkg" + when "Solaris": + arch = Facter["hardwareisa"].value + Facter["operatingsystemrelease"].value + case arch + when "sparc5.8": + retval = [["SMCarc", "/usr/local/pkg/arc-5.21e-sol8-sparc-local"]] + when "i3865.8": + retval = [["SMCarc", "/usr/local/pkg/arc-5.21e-sol8-intel-local"]] + end when "Debian": - return %w{zec} + retval = %w{zec} #when "RedHat": type = :rpm when "Fedora": - return %w{wv} + retval = %w{wv} else - Puppet.notice "No test packags for %s" % $platform - return nil + Puppet.notice "No test packages for %s" % $platform end + + return retval end def mkpkgcomp(pkg) @@ -115,10 +142,7 @@ class TestPackages < Test::Unit::TestCase end def test_latestpkg - pkgs = tstpkg || return - - pkgs.each { |name| - pkg = Puppet.type(:package).create(:name => name) + tstpkgs { |pkg| assert_nothing_raised { assert(pkg.latest, "Package did not return value for 'latest'") } @@ -129,14 +153,10 @@ class TestPackages < Test::Unit::TestCase $stderr.puts "Run as root to perform package installation tests" else def test_installpkg - pkgs = tstpkg || return - pkgs.each { |pkg| + mkpkgs { |pkg| # we first set install to 'true', and make sure something gets # installed assert_nothing_raised { - pkg = Puppet.type(:package).create(:name => pkg, :install => true) - } - assert_nothing_raised { pkg.retrieve } @@ -157,32 +177,33 @@ class TestPackages < Test::Unit::TestCase pkg.retrieve - assert(! pkg.insync?, "Package is insync") + assert(! pkg.insync?, "Package is in sync") assert_events([:package_removed], comp, "package") # and now set install to 'latest' and verify it installs # FIXME this isn't really a very good test -- we should install # a low version, and then upgrade using this. But, eh. - assert_nothing_raised { - pkg[:install] = "latest" - } + if pkg.respond_to?(:latest) + assert_nothing_raised { + pkg[:install] = "latest" + } - assert_events([:package_installed], comp, "package") - - pkg.retrieve - assert(pkg.insync?, "After install, package is not insync") + assert_events([:package_installed], comp, "package") - assert_nothing_raised { - pkg[:install] = false - } + pkg.retrieve + assert(pkg.insync?, "After install, package is not insync") + assert_nothing_raised { + pkg[:install] = false + } - pkg.retrieve + pkg.retrieve - assert(! pkg.insync?, "Package is insync") + assert(! pkg.insync?, "Package is insync") - assert_events([:package_removed], comp, "package") + assert_events([:package_removed], comp, "package") + end } end end |
