diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-26 04:44:25 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-10-26 04:44:25 +0000 |
| commit | 0ae5e3392597452acf6a2e9f0d4ac976b8ec9846 (patch) | |
| tree | e2307bce0ffacb9bf8ed54b0ebe84632b51fd9b8 /test | |
| parent | 0d3db7984fd40769cbb29cde76e081cb06204710 (diff) | |
Adding logging methods to all Puppet::Element instances, and converting all instance log statements to use those methods. Additionally modified logging to take advantage of this by including the path of the logging object in the output. Logs will still need some cleanup to avoid duplicate information.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@731 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/executables/puppetbin.rb | 9 | ||||
| -rwxr-xr-x | test/executables/puppetd.rb | 3 | ||||
| -rwxr-xr-x | test/executables/puppetmasterd.rb | 1 | ||||
| -rw-r--r-- | test/other/log.rb | 22 | ||||
| -rw-r--r-- | test/puppettest.rb | 24 | ||||
| -rwxr-xr-x | test/types/filesources.rb | 4 | ||||
| -rwxr-xr-x | test/types/user.rb | 4 |
7 files changed, 43 insertions, 24 deletions
diff --git a/test/executables/puppetbin.rb b/test/executables/puppetbin.rb index 4a3eb7946..3f9ebda78 100755 --- a/test/executables/puppetbin.rb +++ b/test/executables/puppetbin.rb @@ -36,8 +36,15 @@ class TestPuppetBin < Test::Unit::TestCase @@tmpfiles << "/tmp/puppetbintesting" output = nil + cmd = "puppet" + cmd += " --verbose" + #cmd += " --fqdn %s" % fqdn + cmd += " --confdir %s" % Puppet[:puppetconf] + cmd += " --vardir %s" % Puppet[:puppetvar] + cmd += " --logdest %s" % "/dev/null" + assert_nothing_raised { - system("puppet --logdest /dev/null %s" % file) + system(cmd + " " + file) } assert($? == 0, "Puppet exited with code %s" % $?.to_i) diff --git a/test/executables/puppetd.rb b/test/executables/puppetd.rb index 72cf1f031..547405779 100755 --- a/test/executables/puppetd.rb +++ b/test/executables/puppetd.rb @@ -38,7 +38,8 @@ class TestPuppetDExe < Test::Unit::TestCase cmd += " --verbose" #cmd += " --fqdn %s" % fqdn cmd += " --port %s" % @@port - cmd += " --ssldir %s" % Puppet[:ssldir] + cmd += " --confdir %s" % Puppet[:puppetconf] + cmd += " --vardir %s" % Puppet[:puppetvar] cmd += " --server localhost" # and verify our daemon runs diff --git a/test/executables/puppetmasterd.rb b/test/executables/puppetmasterd.rb index 7051f02a7..6b67e5e37 100755 --- a/test/executables/puppetmasterd.rb +++ b/test/executables/puppetmasterd.rb @@ -81,6 +81,7 @@ class TestPuppetMasterD < Test::Unit::TestCase assert_instance_of(Puppet::TransBucket, retval, "Retrieved non-transportable object") stopmasterd + sleep(1) end # verify that we can run puppetmasterd in parse-only mode diff --git a/test/other/log.rb b/test/other/log.rb index fc92bd38e..4f59716d7 100644 --- a/test/other/log.rb +++ b/test/other/log.rb @@ -124,19 +124,29 @@ class TestLog < Test::Unit::TestCase end def test_logtags + path = tempfile + File.open(path, "w") { |f| f.puts "yayness" } + + file = Puppet::Type::PFile.create( + :path => path, + :check => [:owner, :group, :mode, :checksum] + ) + file.tags = %w{this is a test} + log = nil assert_nothing_raised { log = Puppet::Log.new( :level => :info, - :source => "Puppet", - :message => "A test message", - :tags => %w{this is a set of tags}, - :path => "a path" + :source => file, + :message => "A test message" ) } # This is really stupid - assert(log.tags) - assert(log.path) + assert(log.tags, "Got no tags") + assert(log.path, "Got no path") + + assert_equal(log.tags, file.tags, "Tags were not equal") + assert_equal(log.path, file.path, "Paths were not equal") end end diff --git a/test/puppettest.rb b/test/puppettest.rb index 953a065c0..5b108712d 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -21,13 +21,6 @@ module TestPuppet else @@testcount = 0 end - if $0 =~ /.+\.rb/ - Puppet[:loglevel] = :debug - $VERBOSE = 1 - else - Puppet[:logdest] = "/dev/null" - Puppet[:httplog] = "/dev/null" - end @configpath = File.join(tmpdir, self.class.to_s + "configdir" + @@testcount.to_s @@ -42,6 +35,14 @@ module TestPuppet @@tmpfiles = [@configpath] @@tmppids = [] + + if $0 =~ /.+\.rb/ + Puppet[:loglevel] = :debug + $VERBOSE = 1 + else + Puppet[:logdest] = "/dev/null" + Puppet[:httplog] = "/dev/null" + end end @@ -181,13 +182,13 @@ end module ServerTest include TestPuppet def setup + super + if defined? @@port @@port += 1 else @@port = 8085 end - - super end # create a simple manifest that just creates a file @@ -261,7 +262,8 @@ module ExeTest manifest = mktestmanifest() args += " --manifest %s" % manifest - args += " --ssldir %s" % Puppet[:ssldir] + args += " --confdir %s" % Puppet[:puppetconf] + args += " --vardir %s" % Puppet[:puppetvar] args += " --port %s" % @@port args += " --nonodes" args += " --autosign" @@ -284,7 +286,7 @@ module ExeTest pid = nil %x{#{ps}}.chomp.split(/\n/).each { |line| if line =~ /ruby.+puppetmasterd/ - next if line =~ /tc_/ # skip the test script itself + next if line =~ /\.rb/ # skip the test script itself ary = line.split(" ") pid = ary[1].to_i end diff --git a/test/types/filesources.rb b/test/types/filesources.rb index 98eba2caf..b62171202 100755 --- a/test/types/filesources.rb +++ b/test/types/filesources.rb @@ -14,6 +14,7 @@ require 'puppettest' class TestFileSources < Test::Unit::TestCase include FileTesting def setup + super begin initstorage rescue @@ -24,12 +25,11 @@ class TestFileSources < Test::Unit::TestCase else @port = 8800 end - super end def teardown - clearstorage super + clearstorage end def initstorage diff --git a/test/types/user.rb b/test/types/user.rb index 183cacaa2..1869b3d08 100755 --- a/test/types/user.rb +++ b/test/types/user.rb @@ -355,9 +355,7 @@ class TestUser < Test::Unit::TestCase assert_equal("Puppet Testing User", current?(:comment, user[:name]), "Comment was not set") - tests = Puppet::Type::User.validstates.collect { |name, state| - state.name - } + tests = Puppet::Type::User.validstates user.retrieve tests.each { |test| |
