diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-07 23:56:59 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-07 23:56:59 +0000 |
| commit | 6d8068eddd0d29ec53f62557eb53f6ebb8e40591 (patch) | |
| tree | 8c93181b9325fee95d7ecdc6e79341ff6d3604b0 /test | |
| parent | 162602323406117444ce4375ead91d8f92f2b31a (diff) | |
| download | puppet-6d8068eddd0d29ec53f62557eb53f6ebb8e40591.tar.gz puppet-6d8068eddd0d29ec53f62557eb53f6ebb8e40591.tar.xz puppet-6d8068eddd0d29ec53f62557eb53f6ebb8e40591.zip | |
Moving some of the stand-alone classes into the util/ subdirectory, to clean up the top-level namespace a bit. This is a lot of file modifications, but most of them just change class names and file paths.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2178 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
43 files changed, 234 insertions, 243 deletions
diff --git a/test/client/master.rb b/test/client/master.rb index 8a7bf4f8b..ccd808bbd 100755 --- a/test/client/master.rb +++ b/test/client/master.rb @@ -482,14 +482,14 @@ end # Now make sure the config time is cached assert(master.compile_time, "No stored config time") - assert_equal(master.compile_time, Puppet::Storage.cache(:configuration)[:compile_time], "times did not match") + assert_equal(master.compile_time, Puppet::Util::Storage.cache(:configuration)[:compile_time], "times did not match") time = master.compile_time master.clear File.unlink(file) - Puppet::Storage.store + Puppet::Util::Storage.store # Now make a new master - Puppet::Storage.clear + Puppet::Util::Storage.clear master = mkclient(driver) master.run assert_equal(time, master.compile_time, "time was not retrieved from cache") diff --git a/test/data/types/sshkey/1 b/test/data/types/sshkey/1 index e0da86ee8..840ed19df 100644 --- a/test/data/types/sshkey/1 +++ b/test/data/types/sshkey/1 @@ -18,3 +18,4 @@ config.sage.org,131.106.3.205 ssh-dss AAAAB3NzaC1kc3MAAACBAL2akEcIfQsfm3zCd2hD6P rh3b,192.168.0.56 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAufcvE7s1eRwhUwMBfZ6uFNxkdSdzjSDEn3vjByOjG/eraNhnYAW3rxV7WIf2pEa6JSOMrE1mqsEL75xEtpXlzC949Ysz4+1OSHY52KonoFm/a+FbmbFp81TVuVPYaLoeWN27STiJh+puC5spkIZe0laqT1GU13M4gj6B+j3NLhU= centos1,192.168.0.57 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0DXqYF+3Lf68GkWBAjjKBb6UITNnzm4wiDi/AGjv5+DoVXqDcqHvZ8rZFAMgUe1dVob4pWT2ZWLHW0gicoJCdr4UQbPXlWz1F62z8fo2PRRPlG6KN1wmF7pnyml8jr0wBX8lQZJsMqi4InGozf7wFHLH/7DNGRK3MD6tSp3Z4is= doorstop.cafes.net,205.241.238.186 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApJKeB9/bN5t55zLETHs0MVo/vEkfQ3EzY7178GKLI/yiOFmcn+NvUvUtCQK/xKpod813LBHCODxZPG1Kb0SjlaC/EkFEenb74LNu0o1qXa1GWh3wfaIm0JRNjXqPqxAWTlMs43O2HXwOwmLVhl7SSP3xtTw6h9gREbVKmfBaRdsRfzD0etfz1NCnmGh/1Sh9+j4eeS+IBtwoR5JVhZVhuofHCqs5HZ8gLDgfn8HXP7pMbLkx54cf1R/tmFmn9JGLdTPtEGcSIiu7414XSbfChSC83rGZCDPKHq7ZodiE8GpbWLBnyPXi2AYxTPM7aZMqitIHv3MWf5suV0q0WLGdnQ== +host.domain.com,host1.domain.com,192.168.0.1 dss thisismykey1 diff --git a/test/executables/puppetca.rb b/test/executables/puppetca.rb index 2eafb7f6c..92633c01b 100755 --- a/test/executables/puppetca.rb +++ b/test/executables/puppetca.rb @@ -75,7 +75,7 @@ class TestPuppetCA < Test::Unit::TestCase uid = Puppet::Util.uid(Puppet[:user]) - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 assert(! FileTest.owned?(signedfile), "cert is owned by root") end assert_nothing_raised { diff --git a/test/language/interpreter.rb b/test/language/interpreter.rb index 0b7703a67..ab3b97210 100755 --- a/test/language/interpreter.rb +++ b/test/language/interpreter.rb @@ -198,7 +198,7 @@ class TestInterpreter < Test::Unit::TestCase end end - if Puppet::SUIDManager.uid == 0 and Facter["hostname"].value == "culain" + if Puppet::Util::SUIDManager.uid == 0 and Facter["hostname"].value == "culain" def test_ldapreconnect Puppet[:ldapbase] = "ou=hosts, dc=madstop, dc=com" Puppet[:ldapnodes] = true diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 2354722a9..6d19ba983 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -35,8 +35,8 @@ module PuppetTest dir, method = arg.split(",") when "--debug" $puppet_debug = true - Puppet::Log.level = :debug - Puppet::Log.newdestination(:console) + Puppet::Util::Log.level = :debug + Puppet::Util::Log.newdestination(:console) when "--help" puts usage exit @@ -106,9 +106,9 @@ module PuppetTest def logcollector collector = [] - Puppet::Log.newdestination(collector) + Puppet::Util::Log.newdestination(collector) cleanup do - Puppet::Log.close(collector) + Puppet::Util::Log.close(collector) end collector end @@ -156,14 +156,14 @@ module PuppetTest if textmate? Puppet[:color] = false end - Puppet::Log.newdestination :console - Puppet::Log.level = :debug + Puppet::Util::Log.newdestination :console + Puppet::Util::Log.level = :debug #$VERBOSE = 1 Puppet.info @method_name Puppet[:trace] = true else - Puppet::Log.close - Puppet::Log.newdestination tempfile() + Puppet::Util::Log.close + Puppet::Util::Log.newdestination tempfile() Puppet[:httplog] = tempfile() end @@ -238,7 +238,7 @@ module PuppetTest @@tmppids.clear Puppet::Type.allclear - Puppet::Storage.clear + Puppet::Util::Storage.clear Puppet.clear @memoryatend = Puppet::Util.memory @@ -250,7 +250,7 @@ module PuppetTest end # reset all of the logs - Puppet::Log.close + Puppet::Util::Log.close # Just in case there are processes waiting to die... require 'timeout' diff --git a/test/lib/puppettest/exetest.rb b/test/lib/puppettest/exetest.rb index c6beaf5ba..d0a85956a 100644 --- a/test/lib/puppettest/exetest.rb +++ b/test/lib/puppettest/exetest.rb @@ -48,8 +48,8 @@ module PuppetTest::ExeTest args += " --rundir %s" % File.join(Puppet[:vardir], "run") args += " --vardir %s" % Puppet[:vardir] args += " --masterport %s" % @@port - args += " --user %s" % Puppet::SUIDManager.uid - args += " --group %s" % Puppet::SUIDManager.gid + args += " --user %s" % Puppet::Util::SUIDManager.uid + args += " --group %s" % Puppet::Util::SUIDManager.gid args += " --nonodes" args += " --autosign true" diff --git a/test/lib/puppettest/support/assertions.rb b/test/lib/puppettest/support/assertions.rb index 75056b0db..46e4350fa 100644 --- a/test/lib/puppettest/support/assertions.rb +++ b/test/lib/puppettest/support/assertions.rb @@ -7,12 +7,12 @@ module PuppetTest flunk "Must be uid 0 to run these tests" unless Process.uid == 0 fork do - Puppet::SUIDManager.gid = gid - Puppet::SUIDManager.uid = uid + Puppet::Util::SUIDManager.gid = gid + Puppet::Util::SUIDManager.uid = uid # FIXME: use the tempfile method from puppettest.rb system("mkfifo "+filename) f = File.open(filename, "w") - f << "#{Puppet::SUIDManager.uid}\n#{Puppet::SUIDManager.gid}\n" + f << "#{Puppet::Util::SUIDManager.uid}\n#{Puppet::Util::SUIDManager.gid}\n" yield if block_given? end diff --git a/test/lib/puppettest/support/helpers.rb b/test/lib/puppettest/support/helpers.rb index bd5356d53..dc01fa3b8 100644 --- a/test/lib/puppettest/support/helpers.rb +++ b/test/lib/puppettest/support/helpers.rb @@ -5,7 +5,7 @@ module PuppetTest # UID of nobody. def nonrootuser Etc.passwd { |user| - if user.uid != Puppet::SUIDManager.uid and user.uid > 0 and user.uid < 255 + if user.uid != Puppet::Util::SUIDManager.uid and user.uid > 0 and user.uid < 255 return user end } @@ -13,7 +13,7 @@ module PuppetTest def nonrootgroup Etc.group { |group| - if group.gid != Puppet::SUIDManager.gid and group.gid > 0 and group.gid < 255 + if group.gid != Puppet::Util::SUIDManager.gid and group.gid > 0 and group.gid < 255 return group end } diff --git a/test/other/autoload.rb b/test/other/autoload.rb index 86ba639aa..34f40df24 100755 --- a/test/other/autoload.rb +++ b/test/other/autoload.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/autoload' +require 'puppet/util/autoload' require 'puppettest' class TestAutoload < Test::Unit::TestCase @@ -53,10 +53,10 @@ TestAutoload.newthing(:#{name.to_s}) loader = nil assert_nothing_raised { - loader = Puppet::Autoload.new(klass, :yayness) + loader = Puppet::Util::Autoload.new(klass, :yayness) } - assert_equal(loader.object_id, Puppet::Autoload[klass].object_id, + assert_equal(loader.object_id, Puppet::Util::Autoload[klass].object_id, "Did not retrieve loader object by class") # Make sure we don't fail on missing files @@ -117,7 +117,7 @@ TestAutoload.newthing(:#{name.to_s}) f.puts "$loaded = true" end - auto = Puppet::Autoload.new(self, "test") + auto = Puppet::Util::Autoload.new(self, "test") # Now make sure autoloading modifies $: as necessary assert(! $:.include?(dir), "search path already includes libdir") diff --git a/test/other/config.rb b/test/other/config.rb index b47b3c97a..fad3e9763 100755 --- a/test/other/config.rb +++ b/test/other/config.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/config' +require 'puppet/util/config' require 'puppettest' require 'puppettest/parsertesting' @@ -87,7 +87,7 @@ class TestConfig < Test::Unit::TestCase def mkconfig c = nil assert_nothing_raised { - c = Puppet::Config.new + c = Puppet::Util::Config.new } return c end @@ -546,7 +546,7 @@ yay = /a/path user = nonrootuser() group = nonrootgroup() - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 args[:owner] = user.name args[:group] = group.name end @@ -562,7 +562,7 @@ yay = /a/path assert_equal(mode, filemode(path), "Modes are not equal") # OS X is broken in how it chgrps files - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal") case Facter["operatingsystem"].value @@ -586,7 +586,7 @@ yay = /a/path user = nonrootuser() group = nonrootgroup() - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 args[:owner] = user.name args[:group] = group.name end @@ -601,7 +601,7 @@ yay = /a/path # OS X and *BSD is broken in how it chgrps files - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 assert_equal(user.uid, File.stat(path).uid, "UIDS are not equal") case Facter["operatingsystem"].value @@ -682,9 +682,9 @@ inttest = 27 def test_correct_type_assumptions config = mkconfig - file = Puppet::Config::CFile - element = Puppet::Config::CElement - bool = Puppet::Config::CBoolean + file = Puppet::Util::Config::CFile + element = Puppet::Util::Config::CElement + bool = Puppet::Util::Config::CBoolean # We have to keep these ordered, unfortunately. [ diff --git a/test/other/dsl.rb b/test/other/dsl.rb index b36cca745..f1fd1a1e9 100755 --- a/test/other/dsl.rb +++ b/test/other/dsl.rb @@ -4,7 +4,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' require 'puppet/dsl' -require 'puppet/autoload' +require 'puppet/util/autoload' require 'puppettest' class TestDSL < Test::Unit::TestCase diff --git a/test/other/features.rb b/test/other/features.rb index 1758de783..129c14769 100755 --- a/test/other/features.rb +++ b/test/other/features.rb @@ -6,7 +6,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppettest' -require 'puppet/feature' +require 'puppet/util/feature' class TestFeatures < Test::Unit::TestCase include PuppetTest @@ -14,7 +14,7 @@ class TestFeatures < Test::Unit::TestCase def setup super libdir = tempfile() - @features = Puppet::Feature.new(libdir) + @features = Puppet::Util::Feature.new(libdir) end def test_new diff --git a/test/other/filetype.rb b/test/other/filetype.rb index efe90ef32..81a2af2c8 100755 --- a/test/other/filetype.rb +++ b/test/other/filetype.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/filetype' +require 'puppet/util/filetype' require 'puppettest' class TestFileType < Test::Unit::TestCase @@ -15,7 +15,7 @@ class TestFileType < Test::Unit::TestCase type = nil assert_nothing_raised { - type = Puppet::FileType.filetype(:flat) + type = Puppet::Util::FileType.filetype(:flat) } assert(type, "Could not retrieve flat filetype") @@ -59,7 +59,7 @@ class TestFileType < Test::Unit::TestCase type = nil assert_nothing_raised { - type = Puppet::FileType.filetype(:netinfo) + type = Puppet::Util::FileType.filetype(:netinfo) } assert(type, "Could not retrieve netinfo filetype") diff --git a/test/other/inifile.rb b/test/other/inifile.rb index 5b1dfe0ae..bdac23f7d 100755 --- a/test/other/inifile.rb +++ b/test/other/inifile.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/inifile' +require 'puppet/util/inifile' require 'puppettest' class TestFileType < Test::Unit::TestCase @@ -11,7 +11,7 @@ class TestFileType < Test::Unit::TestCase def setup super - @file = Puppet::IniConfig::File.new + @file = Puppet::Util::IniConfig::File.new end def teardown diff --git a/test/other/loadedfile.rb b/test/other/loadedfile.rb index 353bacd16..2c6b241fb 100755 --- a/test/other/loadedfile.rb +++ b/test/other/loadedfile.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/loadedfile' +require 'puppet/util/loadedfile' require 'puppettest' class TestLoadedFile < Test::Unit::TestCase @@ -14,7 +14,7 @@ class TestLoadedFile < Test::Unit::TestCase path = tempfile() File.open(path, "w") { |f| f.puts "yayness" } assert_nothing_raised { - file = Puppet::LoadedFile.new(path) + file = Puppet::Util::LoadedFile.new(path) } assert(!file.changed?, "File incorrectly returned changed") @@ -34,7 +34,7 @@ class TestLoadedFile < Test::Unit::TestCase File.open(path, "w") { |f| f.puts "yay" } file = nil assert_nothing_raised { - file = Puppet::LoadedFile.new(path) + file = Puppet::Util::LoadedFile.new(path) } assert_nothing_raised { @@ -59,7 +59,7 @@ class TestLoadedFile < Test::Unit::TestCase File.open(file, "w") { |f| f.puts "" } obj = nil assert_nothing_raised { - obj = Puppet::LoadedFile.new(file) + obj = Puppet::Util::LoadedFile.new(file) } # Make sure we don't refresh @@ -86,7 +86,7 @@ class TestLoadedFile < Test::Unit::TestCase File.open(file, "w") { |f| f.puts "" } obj = nil assert_nothing_raised { - obj = Puppet::LoadedFile.new(file) + obj = Puppet::Util::LoadedFile.new(file) } Puppet[:filetimeout] = -10 diff --git a/test/other/log.rb b/test/other/log.rb index 3c720ca15..e1af9897a 100755 --- a/test/other/log.rb +++ b/test/other/log.rb @@ -3,7 +3,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppet' -require 'puppet/log' +require 'puppet/util/log' require 'puppettest' class TestLog < Test::Unit::TestCase @@ -11,22 +11,22 @@ class TestLog < Test::Unit::TestCase def setup super - @oldloglevel = Puppet::Log.level - Puppet::Log.close + @oldloglevel = Puppet::Util::Log.level + Puppet::Util::Log.close end def teardown super - Puppet::Log.close - Puppet::Log.level = @oldloglevel - Puppet::Log.newdestination(:console) + Puppet::Util::Log.close + Puppet::Util::Log.level = @oldloglevel + Puppet::Util::Log.newdestination(:console) end def getlevels levels = nil assert_nothing_raised() { levels = [] - Puppet::Log.eachlevel { |level| levels << level } + Puppet::Util::Log.eachlevel { |level| levels << level } } # Don't test the top levels; too annoying return levels.reject { |level| level == :emerg or level == :crit } @@ -36,7 +36,7 @@ class TestLog < Test::Unit::TestCase levels.collect { |level| next if level == :alert assert_nothing_raised() { - Puppet::Log.new( + Puppet::Util::Log.new( :level => level, :source => "Test", :message => "Unit test for %s" % level @@ -48,16 +48,16 @@ class TestLog < Test::Unit::TestCase def test_logfile fact = nil levels = nil - Puppet::Log.level = :debug + Puppet::Util::Log.level = :debug levels = getlevels logfile = tempfile() fact = nil assert_nothing_raised() { - Puppet::Log.newdestination(logfile) + Puppet::Util::Log.newdestination(logfile) } msgs = mkmsgs(levels) assert(msgs.length == levels.length) - Puppet::Log.close + Puppet::Util::Log.close count = 0 assert(FileTest.exists?(logfile), "Did not create logfile") @@ -78,7 +78,7 @@ class TestLog < Test::Unit::TestCase } } assert_nothing_raised() { - Puppet::Log.newdestination("syslog") + Puppet::Util::Log.newdestination("syslog") } # there's really no way to verify that we got syslog messages... msgs = mkmsgs(levels) @@ -89,16 +89,16 @@ class TestLog < Test::Unit::TestCase fact = nil levels = getlevels assert_nothing_raised() { - Puppet::Log.newdestination(:console) + Puppet::Util::Log.newdestination(:console) } msgs = mkmsgs(levels) assert(msgs.length == levels.length) - Puppet::Log.close + Puppet::Util::Log.close end def test_levelmethods assert_nothing_raised() { - Puppet::Log.newdestination("/dev/null") + Puppet::Util::Log.newdestination("/dev/null") } getlevels.each { |level| assert_nothing_raised() { @@ -108,18 +108,18 @@ class TestLog < Test::Unit::TestCase end def test_output - Puppet::Log.level = :notice - assert(Puppet.err("This is an error").is_a?(Puppet::Log)) + Puppet::Util::Log.level = :notice + assert(Puppet.err("This is an error").is_a?(Puppet::Util::Log)) assert(Puppet.debug("This is debugging").nil?) - Puppet::Log.level = :debug - assert(Puppet.err("This is an error").is_a?(Puppet::Log)) - assert(Puppet.debug("This is debugging").is_a?(Puppet::Log)) + Puppet::Util::Log.level = :debug + assert(Puppet.err("This is an error").is_a?(Puppet::Util::Log)) + assert(Puppet.debug("This is debugging").is_a?(Puppet::Util::Log)) end def test_creatingdirs dir = tempfile() file = File.join(dir, "logfile") - Puppet::Log.newdestination file + Puppet::Util::Log.newdestination file Puppet.info "testing logs" assert(FileTest.directory?(dir)) assert(FileTest.file?(file)) @@ -140,7 +140,7 @@ class TestLog < Test::Unit::TestCase assert(property, "Did not get property") log = nil assert_nothing_raised { - log = Puppet::Log.new( + log = Puppet::Util::Log.new( :level => :info, :source => property, :message => "A test message" @@ -165,10 +165,10 @@ class TestLog < Test::Unit::TestCase # Verify that we can pass strings that match printf args def test_percentlogs - Puppet::Log.newdestination :syslog + Puppet::Util::Log.newdestination :syslog assert_nothing_raised { - Puppet::Log.new( + Puppet::Util::Log.new( :level => :info, :message => "A message with %s in it" ) @@ -183,7 +183,7 @@ class TestLog < Test::Unit::TestCase :check => %w{owner group} ) assert_nothing_raised { - msg = Puppet::Log.new(:level => :info, :message => "This is a message") + msg = Puppet::Util::Log.new(:level => :info, :message => "This is a message") } assert_nothing_raised { msg.source = file @@ -217,7 +217,7 @@ class TestLog < Test::Unit::TestCase def test_destination_matching dest = nil assert_nothing_raised { - dest = Puppet::Log.newdesttype("Destine") do + dest = Puppet::Util::Log.newdesttype("Destine") do def handle(msg) puts msg end @@ -232,36 +232,36 @@ class TestLog < Test::Unit::TestCase dest.match(:yayness) } assert(dest.match("Yayness"), "Did not match yayness") - Puppet::Log.close(dest) + Puppet::Util::Log.close(dest) end def test_autoflush file = tempfile - Puppet::Log.close(:console) - Puppet::Log.newdestination(file) + Puppet::Util::Log.close(:console) + Puppet::Util::Log.newdestination(file) Puppet.warning "A test" assert(File.read(file) !~ /A test/, "File defualted to autoflush") - Puppet::Log.flush + Puppet::Util::Log.flush assert(File.read(file) =~ /A test/, "File did not flush") - Puppet::Log.close(file) + Puppet::Util::Log.close(file) # Now try one with autoflush enabled Puppet[:autoflush] = true file = tempfile - Puppet::Log.newdestination(file) + Puppet::Util::Log.newdestination(file) Puppet.warning "A test" assert(File.read(file) =~ /A test/, "File did not autoflush") - Puppet::Log.close(file) + Puppet::Util::Log.close(file) end def test_reopen Puppet[:autoflush] = true file = tempfile - Puppet::Log.close(:console) - Puppet::Log.newdestination(file) + Puppet::Util::Log.close(:console) + Puppet::Util::Log.newdestination(file) Puppet.warning "A test" assert(File.read(file) =~ /A test/, "File did not flush") @@ -275,11 +275,11 @@ class TestLog < Test::Unit::TestCase "File did not rename") # Now reopen the log - Puppet::Log.reopen + Puppet::Util::Log.reopen Puppet.warning "Reopen test" assert(File.read(file) =~ /Reopen test/, "File did not reopen") - Puppet::Log.close(file) + Puppet::Util::Log.close(file) end end diff --git a/test/other/metrics.rb b/test/other/metrics.rb index a2904b2a5..c4e375e7b 100755 --- a/test/other/metrics.rb +++ b/test/other/metrics.rb @@ -2,8 +2,8 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ -require 'puppet/metric' require 'puppet' +require 'puppet/util/metric' require 'puppettest' require 'puppet/type' diff --git a/test/other/propertychange.rb b/test/other/propertychange.rb index 75c6056de..e3df577d2 100755 --- a/test/other/propertychange.rb +++ b/test/other/propertychange.rb @@ -9,7 +9,7 @@ require 'puppettest' class TestPropertyChange < Test::Unit::TestCase include PuppetTest - class FakeProperty + class FakeProperty < Puppet::Type::Property attr_accessor :is, :should, :parent def change_to_s "fake change" @@ -18,7 +18,7 @@ class TestPropertyChange < Test::Unit::TestCase @is == @should end def log(msg) - Puppet::Log.create( + Puppet::Util::Log.create( :level => :info, :source => self, :message => msg @@ -44,7 +44,7 @@ class TestPropertyChange < Test::Unit::TestCase end def mkchange - property = FakeProperty.new + property = FakeProperty.new :parent => "fakeparent" property.is = :start property.should = :finish property.parent = :parent diff --git a/test/other/report.rb b/test/other/report.rb index 1ecebf307..8bd896d9a 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -16,7 +16,7 @@ class TestReports < Test::Unit::TestCase report = fakereport assert_nothing_raised { - Puppet::Log.newdestination(report) + Puppet::Util::Log.newdestination(report) } # Now make a file for testing logging @@ -35,7 +35,7 @@ class TestReports < Test::Unit::TestCase assert(! report.logs.include?(log), "Report got log message") assert_nothing_raised { - Puppet::Log.close(report) + Puppet::Util::Log.close(report) } log = file.log "This is another message, yo" @@ -197,9 +197,9 @@ class TestReports < Test::Unit::TestCase def test_tagmail_matching report = Puppet::Transaction::Report.new - Puppet::Log.close + Puppet::Util::Log.close [%w{one}, %w{one two}, %w{one two three}, %w{one two three four}].each do |tags| - log = Puppet::Log.new(:level => :notice, :message => tags.join(" "), :tags => tags) + log = Puppet::Util::Log.new(:level => :notice, :message => tags.join(" "), :tags => tags) report << log end diff --git a/test/other/storage.rb b/test/other/storage.rb index 1ad51e4ee..dd68af5bf 100755 --- a/test/other/storage.rb +++ b/test/other/storage.rb @@ -28,14 +28,14 @@ class TestStorage < Test::Unit::TestCase # Load first, since that's what we do in the code base; this creates # all of the necessary directories. assert_nothing_raised { - Puppet::Storage.load + Puppet::Util::Storage.load } hash = {:a => :b, :c => :d} state = nil assert_nothing_raised { - state = Puppet::Storage.cache(f) + state = Puppet::Util::Storage.cache(f) } assert(!state.include?("name")) @@ -45,19 +45,19 @@ class TestStorage < Test::Unit::TestCase } assert_nothing_raised { - Puppet::Storage.store + Puppet::Util::Storage.store } assert_nothing_raised { - Puppet::Storage.clear + Puppet::Util::Storage.clear } assert_nothing_raised { - Puppet::Storage.load + Puppet::Util::Storage.load } # Reset it state = nil assert_nothing_raised { - state = Puppet::Storage.cache(f) + state = Puppet::Util::Storage.cache(f) } assert_equal(state["name"], hash) @@ -75,11 +75,11 @@ class TestStorage < Test::Unit::TestCase threads << Thread.new { 9.times { |b| assert_nothing_raised { - Puppet::Storage.load - state = Puppet::Storage.cache(f) + Puppet::Util::Storage.load + state = Puppet::Util::Storage.cache(f) value.each { |k,v| state[k] = v } state[:e] = rand(100) - Puppet::Storage.store + Puppet::Util::Storage.store } } } @@ -88,13 +88,13 @@ class TestStorage < Test::Unit::TestCase end def test_emptyrestore - Puppet::Storage.load - Puppet::Storage.store - Puppet::Storage.clear - Puppet::Storage.load + Puppet::Util::Storage.load + Puppet::Util::Storage.store + Puppet::Util::Storage.clear + Puppet::Util::Storage.load f = mkfile() - state = Puppet::Storage.cache(f) + state = Puppet::Util::Storage.cache(f) assert_same Hash, state.class assert_equal 0, state.size end @@ -104,18 +104,18 @@ class TestStorage < Test::Unit::TestCase one = Puppet::Type.type(:exec).create :title => "/bin/echo one" [one, :yayness].each do |object| assert_nothing_raised do - hash = Puppet::Storage.cache(object) + hash = Puppet::Util::Storage.cache(object) end assert_equal({}, hash, "Did not get empty hash back for %s" % object) hash[:testing] = true assert_nothing_raised do - hash = Puppet::Storage.cache(object) + hash = Puppet::Util::Storage.cache(object) end assert_equal({:testing => true}, hash, "Did not get hash back for %s" % object) end assert_raise(ArgumentError, "was able to cache from string") do - Puppet::Storage.cache("somethingelse") + Puppet::Util::Storage.cache("somethingelse") end end end diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 3b6333306..e90952a70 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -11,6 +11,16 @@ require 'puppettest/support/resources' class TestTransactions < Test::Unit::TestCase include PuppetTest::FileTesting include PuppetTest::Support::Resources + class Fakeprop <Puppet::Type::Property + attr_accessor :path, :is, :should, :name + def insync? + true + end + def info(*args) + false + end + end + def mkgenerator(&block) $finished = [] @@ -79,7 +89,7 @@ class TestTransactions < Test::Unit::TestCase assert(report.logs.length > 0, "Did not get any report logs") report.logs.each do |obj| - assert_instance_of(Puppet::Log, obj) + assert_instance_of(Puppet::Util::Log, obj) end # Then test the metrics @@ -92,7 +102,7 @@ class TestTransactions < Test::Unit::TestCase assert(metrics.has_key?("changes"), "Did not get change metrics") metrics.each do |name, metric| - assert_instance_of(Puppet::Metric, metric) + assert_instance_of(Puppet::Util::Metric, metric) end end @@ -384,20 +394,24 @@ class TestTransactions < Test::Unit::TestCase :path => path, :ensure => "file" ) - svc = Puppet.type(:service).create( - :name => "thisservicedoesnotexist", - :subscribe => [:file, path] + exec1 = Puppet.type(:exec).create( + :path => ENV["PATH"], + :command => "touch /this/cannot/possibly/exist", + :logoutput => true, + :refreshonly => true, + :subscribe => file, + :title => "one" ) - exec = Puppet.type(:exec).create( + exec2 = Puppet.type(:exec).create( :path => ENV["PATH"], :command => "touch %s" % newfile, :logoutput => true, :refreshonly => true, - :subscribe => [:file, path] + :subscribe => [file, exec1], + :title => "two" ) - assert_apply(file, svc, exec) - assert(FileTest.exists?(path), "File did not get created") + assert_apply(file, exec1, exec2) assert(FileTest.exists?(newfile), "Refresh file did not get created") end @@ -773,14 +787,10 @@ class TestTransactions < Test::Unit::TestCase # Make sure changes generated by eval_generated resources have proxies # set to the top-level resource. def test_proxy_resources - Struct.new("FakeEvalProperty", :path, :is, :should, :name) - Struct::FakeEvalProperty.send(:define_method, :insync?) { true } - Struct::FakeEvalProperty.send(:define_method, :info) { |*args| false } - - type = mkreducer do def evaluate - return Puppet::PropertyChange.new(Struct::FakeEvalProperty.new(:path, :is, :should, self.name)) + return Puppet::PropertyChange.new(Fakeprop.new( + :path => :path, :is => :is, :should => :should, :name => self.name, :parent => "a parent")) end end diff --git a/test/puppet/conffiles.rb b/test/puppet/conffiles.rb index 201ecc5e6..6336968aa 100755 --- a/test/puppet/conffiles.rb +++ b/test/puppet/conffiles.rb @@ -2,9 +2,8 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ -require 'puppet' -require 'puppet/config' require 'puppettest' +require 'puppet/util/config' class TestConfFiles < Test::Unit::TestCase include PuppetTest @@ -73,7 +72,7 @@ class TestConfFiles < Test::Unit::TestCase path = tempfile() sampledata { |data| - config = Puppet::Config.new + config = Puppet::Util::Config.new data.each { |section, hash| hash.each { |param, value| config.setdefaults(section, param => [value, value]) diff --git a/test/puppet/defaults.rb b/test/puppet/defaults.rb index 033fb71bc..19db3fe05 100755 --- a/test/puppet/defaults.rb +++ b/test/puppet/defaults.rb @@ -67,7 +67,7 @@ class TestPuppetDefaults < Test::Unit::TestCase # we don't want user defaults in /, or root defaults in ~ def testDefaultsInCorrectRoots notval = nil - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 notval = Regexp.new(File.expand_path("~")) else notval = /^\/var|^\/etc/ diff --git a/test/puppet/tc_suidmanager.rb b/test/puppet/tc_suidmanager.rb index 5561992e3..b90261f44 100755 --- a/test/puppet/tc_suidmanager.rb +++ b/test/puppet/tc_suidmanager.rb @@ -25,8 +25,8 @@ class TestSUIDManager < Test::Unit::TestCase # modification of a closure. Should the bug rear itself again, this # test will fail. assert_nothing_raised do - Puppet::SUIDManager.uid - Puppet::SUIDManager.uid + Puppet::Util::SUIDManager.uid + Puppet::Util::SUIDManager.uid end end @@ -34,16 +34,16 @@ class TestSUIDManager < Test::Unit::TestCase if @run user = nonrootuser assert_nothing_raised do - Puppet::SUIDManager.egid = user.gid - Puppet::SUIDManager.euid = user.uid + Puppet::Util::SUIDManager.egid = user.gid + Puppet::Util::SUIDManager.euid = user.uid end - assert_equal(Puppet::SUIDManager.euid, Process.euid) - assert_equal(Puppet::SUIDManager.egid, Process.egid) + assert_equal(Puppet::Util::SUIDManager.euid, Process.euid) + assert_equal(Puppet::Util::SUIDManager.egid, Process.egid) assert_nothing_raised do - Puppet::SUIDManager.euid = 0 - Puppet::SUIDManager.egid = 0 + Puppet::Util::SUIDManager.euid = 0 + Puppet::Util::SUIDManager.egid = 0 end end end @@ -61,7 +61,7 @@ class TestSUIDManager < Test::Unit::TestCase uid, gid = [nil, nil] assert_nothing_raised do - Puppet::SUIDManager.asuser(user.uid, user.gid) do + Puppet::Util::SUIDManager.asuser(user.uid, user.gid) do uid = Process.euid gid = Process.egid end @@ -75,7 +75,7 @@ class TestSUIDManager < Test::Unit::TestCase # NOTE: not sure what shells this will work on.. if @run user = nonrootuser - status = Puppet::SUIDManager.system("exit $EUID", user.uid, user.gid) + status = Puppet::Util::SUIDManager.system("exit $EUID", user.uid, user.gid) assert_equal(user.uid, status.exitstatus) end end @@ -90,7 +90,7 @@ class TestSUIDManager < Test::Unit::TestCase # way that run_and_capture works. user = nil uid = nil - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 userobj = nonrootuser() user = userobj.name uid = userobj.uid @@ -98,7 +98,7 @@ class TestSUIDManager < Test::Unit::TestCase uid = Process.uid end cmd = [%{/bin/echo $EUID}] - output = Puppet::SUIDManager.run_and_capture(cmd, uid)[0].chomp + output = Puppet::Util::SUIDManager.run_and_capture(cmd, uid)[0].chomp assert_equal(uid.to_s, output) end end diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index ba362c1e6..792d8bcf9 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -176,7 +176,7 @@ class TestGroupProvider < Test::Unit::TestCase } end - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 def test_mkgroup gobj = nil comp = nil diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index 1e50dc58c..2a015e086 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -19,7 +19,7 @@ class TestParsedHostProvider < Test::Unit::TestCase end def teardown - Puppet::FileType.filetype(:ram).clear + Puppet::Util::FileType.filetype(:ram).clear @provider.filetype = @oldfiletype @provider.clear super @@ -32,7 +32,7 @@ class TestParsedHostProvider < Test::Unit::TestCase # Here we just create a fake host type that answers to all of the methods # but does not modify our actual system. def mkfaketype - @provider.filetype = Puppet::FileType.filetype(:ram) + @provider.filetype = Puppet::Util::FileType.filetype(:ram) end def mkhosthash diff --git a/test/ral/providers/mount/parsed.rb b/test/ral/providers/mount/parsed.rb index 83713708d..d6b507f08 100755 --- a/test/ral/providers/mount/parsed.rb +++ b/test/ral/providers/mount/parsed.rb @@ -19,7 +19,7 @@ class TestParsedMounts < Test::Unit::TestCase end def teardown - Puppet::FileType.filetype(:ram).clear + Puppet::Util::FileType.filetype(:ram).clear @provider.filetype = @oldfiletype @provider.clear super @@ -65,7 +65,7 @@ class TestParsedMounts < Test::Unit::TestCase # Here we just create a fake host type that answers to all of the methods # but does not modify our actual system. def mkfaketype - @provider.filetype = Puppet::FileType.filetype(:ram) + @provider.filetype = Puppet::Util::FileType.filetype(:ram) end def test_default_target @@ -146,7 +146,7 @@ class TestParsedMounts < Test::Unit::TestCase end end - if Puppet::SUIDManager.uid == 0 and Facter.value(:operatingsystem) != "Darwin" + if Puppet::Util::SUIDManager.uid == 0 and Facter.value(:operatingsystem) != "Darwin" def test_mountfs fs = nil case Facter.value(:hostname) diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb index fb5eb35ad..4f2751f39 100755 --- a/test/ral/providers/parsedfile.rb +++ b/test/ral/providers/parsedfile.rb @@ -4,7 +4,7 @@ $:.unshift("../../lib") if __FILE__ =~ /\.rb$/ require 'puppettest' require 'puppettest/fileparsing' -require 'puppet/filetype' +require 'puppet/util/filetype' require 'puppet/provider/parsedfile' require 'facter' @@ -100,8 +100,8 @@ class TestParsedFile < Test::Unit::TestCase def test_filetype prov = mkprovider - flat = Puppet::FileType.filetype(:flat) - ram = Puppet::FileType.filetype(:ram) + flat = Puppet::Util::FileType.filetype(:flat) + ram = Puppet::Util::FileType.filetype(:ram) assert_nothing_raised do prov.filetype = :flat end @@ -126,7 +126,7 @@ class TestParsedFile < Test::Unit::TestCase end # The default filetype is 'ram' - assert_instance_of(Puppet::FileType.filetype(:ram), obj) + assert_instance_of(Puppet::Util::FileType.filetype(:ram), obj) newobj = nil assert_nothing_raised do diff --git a/test/ral/providers/parsedport.rb b/test/ral/providers/parsedport.rb index 929a02327..acd6eda1f 100755 --- a/test/ral/providers/parsedport.rb +++ b/test/ral/providers/parsedport.rb @@ -19,7 +19,7 @@ require 'puppettest' # end # # def teardown -# Puppet::FileType.filetype(:ram).clear +# Puppet::Util::FileType.filetype(:ram).clear # @provider.filetype = @oldfiletype # @provider.clear # super diff --git a/test/ral/providers/parsedsshkey.rb b/test/ral/providers/parsedsshkey.rb index f79e7be94..854a1342a 100755 --- a/test/ral/providers/parsedsshkey.rb +++ b/test/ral/providers/parsedsshkey.rb @@ -18,7 +18,7 @@ class TestParsedSSHKey < Test::Unit::TestCase end def teardown - Puppet::FileType.filetype(:ram).clear + Puppet::Util::FileType.filetype(:ram).clear @provider.filetype = @oldfiletype @provider.clear super diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 94baca37b..319db0a5f 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -401,7 +401,7 @@ class TestUserProvider < Test::Unit::TestCase assert_equal(main.sort, list.sort, "Group list is not equal") end - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 def test_simpleuser name = "pptest" diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb index bf166c70f..3baf6aac3 100755 --- a/test/ral/types/cron.rb +++ b/test/ral/types/cron.rb @@ -16,13 +16,13 @@ class TestCron < Test::Unit::TestCase # god i'm lazy @crontype = Puppet.type(:cron) @oldfiletype = @crontype.filetype - @fakefiletype = Puppet::FileType.filetype(:ram) + @fakefiletype = Puppet::Util::FileType.filetype(:ram) @crontype.filetype = @fakefiletype end def teardown @crontype.filetype = @oldfiletype - Puppet::FileType.filetype(:ram).clear + Puppet::Util::FileType.filetype(:ram).clear super end @@ -138,7 +138,7 @@ class TestCron < Test::Unit::TestCase end def test_simpleparsing - @fakefiletype = Puppet::FileType.filetype(:ram) + @fakefiletype = Puppet::Util::FileType.filetype(:ram) @crontype.filetype = @fakefiletype @crontype.retrieve(@me) @@ -362,7 +362,7 @@ class TestCron < Test::Unit::TestCase obj = nil assert_nothing_raised { - obj = type.new(Puppet::SUIDManager.uid) + obj = type.new(Puppet::Util::SUIDManager.uid) } txt = nil @@ -522,7 +522,7 @@ class TestCron < Test::Unit::TestCase end def test_data - @fakefiletype = Puppet::FileType.filetype(:ram) + @fakefiletype = Puppet::Util::FileType.filetype(:ram) @crontype.filetype = @fakefiletype @crontype.retrieve(@me) diff --git a/test/ral/types/exec.rb b/test/ral/types/exec.rb index 300e26367..6dd126631 100755 --- a/test/ral/types/exec.rb +++ b/test/ral/types/exec.rb @@ -113,59 +113,37 @@ class TestExec < Test::Unit::TestCase tmpfile = tempfile() @@tmpfiles.push tmpfile trans = nil - File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| - of.puts rand(100) - } file = Puppet.type(:file).create( :path => tmpfile, - :checksum => "md5" + :content => "yay" ) - assert_instance_of(Puppet.type(:file), file) + # Get the file in sync + assert_apply(file) + + # Now make an exec + maker = tempfile() assert_nothing_raised { cmd = Puppet.type(:exec).create( - :command => "pwd", + :command => "touch %s" % maker, :path => "/usr/bin:/bin:/usr/sbin:/sbin", :subscribe => file, :refreshonly => true ) } - assert_instance_of(Puppet.type(:exec), cmd) + assert(cmd, "did not make exec") - comp = Puppet.type(:component).create(:name => "RefreshTest") - [file,cmd].each { |obj| - comp.push obj - } - events = nil - assert_nothing_raised { - trans = comp.evaluate - file.retrieve + assert_nothing_raised do + assert(! cmd.check, "Check passed when refreshonly is set") + end - sum = file.property(:checksum) - assert(sum.insync?, "checksum is not in sync") - events = trans.evaluate.collect { |event| - event.event - } - } - # the first checksum shouldn't result in a changed file - assert_equal([],events) - File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| - of.puts rand(100) - of.puts rand(100) - of.puts rand(100) - } - assert_nothing_raised { - trans = comp.evaluate - sum = file.property(:checksum) - events = trans.evaluate.collect { |event| event.event } - } - - # verify that only the file_changed event was kicked off, not the - # command_executed - assert_equal( - [:file_changed, :triggered], - events - ) + assert_events([], file, cmd) + assert(! FileTest.exists?(maker), "made file without refreshing") + + # Now change our content, so we throw a refresh + file[:content] = "yayness" + assert_events([:file_changed, :triggered], file, cmd) + assert(FileTest.exists?(maker), "file was not made in refresh") end def test_refreshonly @@ -181,6 +159,9 @@ class TestExec < Test::Unit::TestCase # Checks should always fail when refreshonly is enabled assert(!cmd.check, "Check passed with refreshonly true") + # Now make sure it passes if we pass in "true" + assert(cmd.check(true), "Check failed with refreshonly true while refreshing") + # Now set it to false cmd[:refreshonly] = false assert(cmd.check, "Check failed with refreshonly false") @@ -330,7 +311,7 @@ class TestExec < Test::Unit::TestCase assert_events([:executed_command], comp) end - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 # Verify that we can execute commands as a special user def mknverify(file, user, group = nil, id = true) File.umask(0022) diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb index af4a3a8b3..b69d6cd3d 100755 --- a/test/ral/types/file.rb +++ b/test/ral/types/file.rb @@ -39,19 +39,19 @@ class TestFile < Test::Unit::TestCase end def teardown - Puppet::Storage.clear + Puppet::Util::Storage.clear system("rm -rf %s" % Puppet[:statefile]) super end def initstorage - Puppet::Storage.init - Puppet::Storage.load + Puppet::Util::Storage.init + Puppet::Util::Storage.load end def clearstorage - Puppet::Storage.store - Puppet::Storage.clear + Puppet::Util::Storage.store + Puppet::Util::Storage.clear end def test_owner @@ -108,7 +108,7 @@ class TestFile < Test::Unit::TestCase } end - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 def test_createasuser dir = tmpdir() diff --git a/test/ral/types/filebucket.rb b/test/ral/types/filebucket.rb index 931c571dc..568a4b203 100755 --- a/test/ral/types/filebucket.rb +++ b/test/ral/types/filebucket.rb @@ -51,13 +51,13 @@ class TestFileBucket < Test::Unit::TestCase end def initstorage - Puppet::Storage.init - Puppet::Storage.load + Puppet::Util::Storage.init + Puppet::Util::Storage.load end def clearstorage - Puppet::Storage.store - Puppet::Storage.clear + Puppet::Util::Storage.store + Puppet::Util::Storage.clear end def test_simplebucket diff --git a/test/ral/types/fileignoresource.rb b/test/ral/types/fileignoresource.rb index 214a865f5..fa01aecdc 100755 --- a/test/ral/types/fileignoresource.rb +++ b/test/ral/types/fileignoresource.rb @@ -20,13 +20,13 @@ class TestFileIgnoreSources < Test::Unit::TestCase #This is not needed unless using md5 (correct me if I'm wrong) def initstorage - Puppet::Storage.init - Puppet::Storage.load + Puppet::Util::Storage.init + Puppet::Util::Storage.load end def clearstorage - Puppet::Storage.store - Puppet::Storage.clear + Puppet::Util::Storage.store + Puppet::Util::Storage.clear end def test_ignore_simple_source diff --git a/test/ral/types/filesources.rb b/test/ral/types/filesources.rb index dc4bbdb07..1badfaa11 100755 --- a/test/ral/types/filesources.rb +++ b/test/ral/types/filesources.rb @@ -27,8 +27,8 @@ class TestFileSources < Test::Unit::TestCase end def initstorage - Puppet::Storage.init - Puppet::Storage.load + Puppet::Util::Storage.init + Puppet::Util::Storage.load end # Make a simple recursive tree. @@ -100,7 +100,7 @@ class TestFileSources < Test::Unit::TestCase end assert_equal("file", result[:type]) assert(result[:checksum], "did not get value for checksum") - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 assert(result.has_key?(:owner), "Lost owner in describe") else assert(! result.has_key?(:owner), diff --git a/test/ral/types/service.rb b/test/ral/types/service.rb index 005f00e63..93e41158c 100755 --- a/test/ral/types/service.rb +++ b/test/ral/types/service.rb @@ -230,7 +230,7 @@ class TestLocalService < Test::Unit::TestCase } end - unless Puppet::SUIDManager.uid == 0 + unless Puppet::Util::SUIDManager.uid == 0 puts "run as root to test service start/stop" else def test_servicestartstop diff --git a/test/ral/types/user.rb b/test/ral/types/user.rb index 6feb90742..641d9cd82 100755 --- a/test/ral/types/user.rb +++ b/test/ral/types/user.rb @@ -67,7 +67,7 @@ class TestUser < Test::Unit::TestCase user = Puppet.type(:user).create( :name => name, :comment => "Puppet Testing User", - :gid => Puppet::SUIDManager.gid, + :gid => Puppet::Util::SUIDManager.gid, :shell => findshell(), :home => "/home/%s" % name ) diff --git a/test/ral/types/zone.rb b/test/ral/types/zone.rb index d5cb0f739..c1724b93a 100755 --- a/test/ral/types/zone.rb +++ b/test/ral/types/zone.rb @@ -189,7 +189,7 @@ end" "Got incorrect config text") end - if Puppet::SUIDManager.uid == 0 + if Puppet::Util::SUIDManager.uid == 0 # Make sure our ensure process actually works. def test_ensure_sync zone = mkzone("ensuretesting") diff --git a/test/server/logger.rb b/test/server/logger.rb index 6b7e6a8f4..60d5458ef 100755 --- a/test/server/logger.rb +++ b/test/server/logger.rb @@ -13,7 +13,7 @@ class TestLogger < Test::Unit::TestCase def setup super #Puppet[:debug] = true - Puppet::Log.newdestination :console + Puppet::Util::Log.newdestination :console end # Test the log driver manually @@ -25,7 +25,7 @@ class TestLogger < Test::Unit::TestCase msg = nil assert_nothing_raised { - msg = Puppet::Log.create( + msg = Puppet::Util::Log.create( :level => :warning, :message => "This is a message" ) @@ -45,7 +45,7 @@ class TestLogger < Test::Unit::TestCase msg = nil assert_nothing_raised { - msg = Puppet::Log.create( + msg = Puppet::Util::Log.create( :level => :warning, :message => "This is a remote message" ) @@ -68,7 +68,7 @@ class TestLogger < Test::Unit::TestCase msg = nil assert_nothing_raised { - msg = Puppet::Log.create( + msg = Puppet::Util::Log.create( :level => :warning, :message => "This is a logclient message" ) @@ -89,8 +89,8 @@ class TestLogger < Test::Unit::TestCase clientlog = tempfile() serverlog = tempfile() Puppet.warning "serverlog is %s" % serverlog - Puppet::Log.newdestination clientlog - Puppet::Log.close(:syslog) + Puppet::Util::Log.newdestination clientlog + Puppet::Util::Log.close(:syslog) # For testing Puppet[:autosign] = true @@ -109,8 +109,8 @@ class TestLogger < Test::Unit::TestCase # Start our server serverpid = fork { - Puppet::Log.close(clientlog) - Puppet::Log.newdestination serverlog + Puppet::Util::Log.close(clientlog) + Puppet::Util::Log.newdestination serverlog assert_nothing_raised() { trap(:INT) { logger.shutdown } logger.start @@ -137,7 +137,7 @@ class TestLogger < Test::Unit::TestCase :warning => "XMLRPC2", :err => "XMLRPC3" }.each { |level, str| - msg = CGI.escape(YAML.dump(Puppet::Log.create( + msg = CGI.escape(YAML.dump(Puppet::Util::Log.create( :level => level, :message => str ))) @@ -149,7 +149,7 @@ class TestLogger < Test::Unit::TestCase # and now use the normal client action # Set the log destination to be the server - Puppet::Log.newdestination "localhost:%s" % @@port + Puppet::Util::Log.newdestination "localhost:%s" % @@port # And now do some logging assert_nothing_raised { diff --git a/test/util/posixtest.rb b/test/util/posixtest.rb index 354e3ad4c..7939afd46 100755 --- a/test/util/posixtest.rb +++ b/test/util/posixtest.rb @@ -106,7 +106,7 @@ class TestPosixUtil < Test::Unit::TestCase # know them def test_gidbyunknownid gid = nil - group = Puppet::SUIDManager.gid + group = Puppet::Util::SUIDManager.gid assert_nothing_raised { gid = Puppet::Util.gid(group) } @@ -118,7 +118,7 @@ class TestPosixUtil < Test::Unit::TestCase def user require 'etc' unless defined? @user - obj = Etc.getpwuid(Puppet::SUIDManager.uid) + obj = Etc.getpwuid(Puppet::Util::SUIDManager.uid) @user = obj.name end return @user @@ -134,7 +134,7 @@ class TestPosixUtil < Test::Unit::TestCase } assert(uid, "Could not retrieve uid for %s" % user) - assert_equal(Puppet::SUIDManager.uid, uid, "UIDs did not match") + assert_equal(Puppet::Util::SUIDManager.uid, uid, "UIDs did not match") end # Then verify we can retrieve a known user by uid @@ -160,7 +160,7 @@ class TestPosixUtil < Test::Unit::TestCase # know them def test_uidbyunknownid uid = nil - user = Puppet::SUIDManager.uid + user = Puppet::Util::SUIDManager.uid assert_nothing_raised { uid = Puppet::Util.uid(user) } diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 86db02305..fd7c6c38f 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -84,7 +84,7 @@ class TestPuppetUtil < Test::Unit::TestCase end end - unless Puppet::SUIDManager.uid == 0 + unless Puppet::Util::SUIDManager.uid == 0 $stderr.puts "Run as root to perform Utility tests" def test_nothing end @@ -118,23 +118,23 @@ class TestPuppetUtil < Test::Unit::TestCase if group gid = group.gid else - gid = Puppet::SUIDManager.gid + gid = Puppet::Util::SUIDManager.gid end uid = nil if user uid = user.uid else - uid = Puppet::SUIDManager.uid + uid = Puppet::Util::SUIDManager.uid end assert_nothing_raised { - Puppet::SUIDManager.asuser(*args) { - assert_equal(Puppet::SUIDManager.euid, uid, "UID is %s instead of %s" % - [Puppet::SUIDManager.euid, uid] + Puppet::Util::SUIDManager.asuser(*args) { + assert_equal(Puppet::Util::SUIDManager.euid, uid, "UID is %s instead of %s" % + [Puppet::Util::SUIDManager.euid, uid] ) - assert_equal(Puppet::SUIDManager.egid, gid, "GID is %s instead of %s" % - [Puppet::SUIDManager.egid, gid] + assert_equal(Puppet::Util::SUIDManager.egid, gid, "GID is %s instead of %s" % + [Puppet::Util::SUIDManager.egid, gid] ) system("touch %s" % file) } @@ -189,7 +189,7 @@ class TestPuppetUtil < Test::Unit::TestCase rescue end - assert(Puppet::SUIDManager.euid == 0, "UID did not get reset") + assert(Puppet::Util::SUIDManager.euid == 0, "UID did not get reset") end end |
