diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-17 15:12:48 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-17 15:12:48 +0000 |
| commit | 0472b2410225927226272c5ecc14d1ab6cdb9f09 (patch) | |
| tree | 2d2c2fac46b2b155f5ae011e381c80f52ab209d4 | |
| parent | 5ddbc3659d4a46bd9a688702668df0301d57ade1 (diff) | |
| download | puppet-0472b2410225927226272c5ecc14d1ab6cdb9f09.tar.gz puppet-0472b2410225927226272c5ecc14d1ab6cdb9f09.tar.xz puppet-0472b2410225927226272c5ecc14d1ab6cdb9f09.zip | |
First batch of fixes from running tests.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1797 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/puppet/type/pfile.rb | 3 | ||||
| -rwxr-xr-x | test/lib/puppettest.rb | 2 | ||||
| -rw-r--r-- | test/lib/puppettest/reporttesting.rb | 3 | ||||
| -rwxr-xr-x | test/other/log.rb | 16 | ||||
| -rwxr-xr-x | test/other/report.rb | 6 | ||||
| -rwxr-xr-x | test/rails/railsparameter.rb | 10 | ||||
| -rwxr-xr-x | test/rails/railsresource.rb | 10 |
7 files changed, 27 insertions, 23 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 7f2ff798c..233d01da6 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -193,7 +193,8 @@ module Puppet autorequire(type) do if @states.include?(state) # The user/group states automatically converts to IDs - val = @states[state].shouldorig[0] + next unless should = @states[state].shouldorig + val = should[0] if val.is_a?(Integer) or val =~ /^\d+$/ nil else diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 55a502b8c..de2747336 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -132,7 +132,7 @@ module PuppetTest @@tmpfilenum = 1 end - f = File.join(self.tmpdir(), self.class.to_s + "_" + @method_name + + f = File.join(self.tmpdir(), self.class.to_s + "_" + @method_name.to_s + @@tmpfilenum.to_s) @@tmpfiles << f return f diff --git a/test/lib/puppettest/reporttesting.rb b/test/lib/puppettest/reporttesting.rb index fa9937ab9..67d715d4a 100644 --- a/test/lib/puppettest/reporttesting.rb +++ b/test/lib/puppettest/reporttesting.rb @@ -4,7 +4,8 @@ module PuppetTest::Reporttesting report = Puppet::Transaction::Report.new 3.times { |i| - log = Puppet.info("Report test message %s" % i) + # We have to use warning so that the logs always happen + log = Puppet.warning("Report test message %s" % i) log.tags = %w{a list of tags} log.tags << "tag%s" % i diff --git a/test/other/log.rb b/test/other/log.rb index c341ace68..6cf6da2d9 100755 --- a/test/other/log.rb +++ b/test/other/log.rb @@ -6,8 +6,6 @@ require 'puppet' require 'puppet/log' require 'puppettest' -# $Id$ - class TestLog < Test::Unit::TestCase include PuppetTest @@ -239,8 +237,9 @@ class TestLog < Test::Unit::TestCase def test_autoflush file = tempfile + Puppet::Log.close(:console) Puppet::Log.newdestination(file) - Puppet.info "A test" + Puppet.warning "A test" assert(File.read(file) !~ /A test/, "File defualted to autoflush") Puppet::Log.flush @@ -252,7 +251,7 @@ class TestLog < Test::Unit::TestCase Puppet[:autoflush] = true file = tempfile Puppet::Log.newdestination(file) - Puppet.info "A test" + Puppet.warning "A test" assert(File.read(file) =~ /A test/, "File did not autoflush") Puppet::Log.close(file) @@ -261,8 +260,9 @@ class TestLog < Test::Unit::TestCase def test_reopen Puppet[:autoflush] = true file = tempfile + Puppet::Log.close(:console) Puppet::Log.newdestination(file) - Puppet.info "A test" + Puppet.warning "A test" assert(File.read(file) =~ /A test/, "File did not flush") # Rename the file @@ -270,15 +270,17 @@ class TestLog < Test::Unit::TestCase File.rename(file, newfile) # Send another log - Puppet.info "Another test" + Puppet.warning "Another test" assert(File.read(newfile) =~ /Another test/, "File did not rename") # Now reopen the log Puppet::Log.reopen - Puppet.info "Reopen test" + Puppet.warning "Reopen test" assert(File.read(file) =~ /Reopen test/, "File did not reopen") Puppet::Log.close(file) end end + +# $Id$ diff --git a/test/other/report.rb b/test/other/report.rb index 945c5adc0..a459e0cb2 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -29,7 +29,7 @@ class TestReports < Test::Unit::TestCase assert(report.logs.include?(log), "Report did not get log message") - log = Puppet.info "This is a non-sourced message" + log = Puppet.warning "This is a non-sourced message" assert(! report.logs.include?(log), "Report got log message") @@ -60,8 +60,8 @@ class TestReports < Test::Unit::TestCase # Create a bunch of log messages in an array. report = Puppet::Transaction::Report.new - 10.times { |i| - log = Puppet.info("Report test message %s" % i) + 3.times { |i| + log = Puppet.warning("Report test message %s" % i) log.tags = %w{a list of tags} log.tags << "tag%s" % i diff --git a/test/rails/railsparameter.rb b/test/rails/railsparameter.rb index 2c974ff0e..46a12e57c 100755 --- a/test/rails/railsparameter.rb +++ b/test/rails/railsparameter.rb @@ -7,11 +7,11 @@ require 'puppet/rails' require 'puppettest' require 'puppettest/railstesting' +# Don't do any tests w/out this class +if defined? ActiveRecord::Base class TestRailsParameter < Test::Unit::TestCase include PuppetTest::RailsTesting - # Don't do any tests w/out this class - if defined? ActiveRecord::Base # Create a resource param from a rails parameter def test_to_resourceparam railsinit @@ -44,9 +44,9 @@ class TestRailsParameter < Test::Unit::TestCase assert_equal(value, pparam.send(name), "%s was not equal" % name) end end - else - $stderr.puts "Install Rails for Rails and Caching tests" - end +end +else + $stderr.puts "Install Rails for Rails and Caching tests" end # $Id$ diff --git a/test/rails/railsresource.rb b/test/rails/railsresource.rb index 0dc70893b..666d26bcf 100755 --- a/test/rails/railsresource.rb +++ b/test/rails/railsresource.rb @@ -8,12 +8,12 @@ require 'puppettest' require 'puppettest/railstesting' require 'puppettest/resourcetesting' +# Don't do any tests w/out this class +if defined? ActiveRecord::Base class TestRailsResource < Test::Unit::TestCase include PuppetTest::RailsTesting include PuppetTest::ResourceTesting - # Don't do any tests w/out this class - if defined? ActiveRecord::Base # Create a resource param from a rails parameter def test_to_resource railsinit @@ -54,9 +54,9 @@ class TestRailsResource < Test::Unit::TestCase assert_equal("/tmp/to_resource", res.title) assert_equal(source, res.source) end - else - $stderr.puts "Install Rails for Rails and Caching tests" - end +end +else + $stderr.puts "Install Rails for Rails and Caching tests" end # $Id$ |
