[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
Nick Lewis
nick at puppetlabs.com
Wed Jul 14 10:36:42 UTC 2010
The following commit has been merged in the upstream branch:
commit cdd43825cee233af478d807cddda346e9d1fe142
Author: Matt Robinson <matt at puppetlabs.com>
Date: Wed Jul 7 10:30:15 2010 -0700
[#4114] Fix failures in the unit tests
The initial commit changed the name of a method (close -> close_all) and
changed the way the array log destination worked before we saw that the
unit tests were using it differently.
diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index 403733d..e748e51 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -218,17 +218,12 @@ end
Puppet::Util::Log.newdesttype :array do
match "Array"
- attr_accessor :messages
- def initialize
- @messages = []
+ def initialize(messages)
+ @messages = messages
end
def handle(msg)
@messages << msg
end
-
- def close
- @messages.clear
- end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index bd5b9a1..e7dd554 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -65,6 +65,8 @@ Spec::Runner.configure do |config|
end
$tmpfiles.clear
end
+
+ Puppet::Util::Log.close_all
end
config.prepend_before :each do
@@ -79,6 +81,9 @@ Spec::Runner.configure do |config|
# Avoid opening ports to the outside world
Puppet.settings[:bindaddress] = "127.0.0.1"
+
+ @logs = []
+ Puppet::Util::Log.newdestination(@logs)
end
end
diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb
index df3c36f..e188a23 100755
--- a/spec/unit/util/log_spec.rb
+++ b/spec/unit/util/log_spec.rb
@@ -6,22 +6,11 @@ require 'puppet/util/log'
describe Puppet::Util::Log do
it "should write a given message to the specified destination" do
- Puppet::Util::Log.newdestination(:array)
+ arraydest = []
+ Puppet::Util::Log.newdestination(arraydest)
Puppet::Util::Log.new(:level => :notice, :message => "foo")
- message = Puppet::Util::Log.destinations[:array].messages.shift.message
+ message = arraydest.last.message
message.should == "foo"
-
- Puppet::Util::Log.close_all
- end
-
- it "should be able to close all log destinations" do
- destinations = stub_everything('destinations')
- destinations.stubs(:keys).returns %w{foo bar}
- Puppet::Util::Log.expects(:destinations).returns(destinations)
- Puppet::Util::Log.expects(:close).with("foo")
- Puppet::Util::Log.expects(:close).with("bar")
-
- Puppet::Util::Log.close_all
end
describe Puppet::Util::Log::DestConsole do
@@ -96,9 +85,9 @@ describe Puppet::Util::Log do
end
it "should flush the log queue when the first destination is specified" do
+ Puppet::Util::Log.close_all
Puppet::Util::Log.expects(:flushqueue)
Puppet::Util::Log.newdestination(:array)
- Puppet::Util::Log.close_all
end
it "should convert the level to a symbol if it's passed in as a string" do
diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb
index 41b07d4..62a66fc 100755
--- a/spec/unit/util/logging_spec.rb
+++ b/spec/unit/util/logging_spec.rb
@@ -41,6 +41,7 @@ describe Puppet::Util::Logging do
end
it "should queue logs sent without a specified destination" do
+ Puppet::Util::Log.close_all
Puppet::Util::Log.expects(:queuemessage)
@logger.notice "foo"
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index 32f57f3..f94fb4c 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -319,7 +319,7 @@ module PuppetTest
end
# reset all of the logs
- Puppet::Util::Log.close
+ Puppet::Util::Log.close_all
@logs.clear
# Just in case there are processes waiting to die...
diff --git a/test/util/log.rb b/test/util/log.rb
index 00db10e..b28d601 100755
--- a/test/util/log.rb
+++ b/test/util/log.rb
@@ -12,14 +12,13 @@ class TestLog < Test::Unit::TestCase
def setup
super
@oldloglevel = Puppet::Util::Log.level
- Puppet::Util::Log.close
+ Puppet::Util::Log.close_all
end
def teardown
super
- Puppet::Util::Log.close
+ Puppet::Util::Log.close_all
Puppet::Util::Log.level = @oldloglevel
- Puppet::Util::Log.newdestination(:console)
end
def getlevels
@@ -57,7 +56,7 @@ class TestLog < Test::Unit::TestCase
}
msgs = mkmsgs(levels)
assert(msgs.length == levels.length)
- Puppet::Util::Log.close
+ Puppet::Util::Log.close_all
count = 0
assert(FileTest.exists?(logfile), "Did not create logfile")
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list