Fix the exception message shown when there's an IOError
while closing a socket in the pool.
This commit is contained in:
parent
9076432c48
commit
fa0a933780
|
@ -49,8 +49,7 @@ module Mongo
|
|||
begin
|
||||
sock.close
|
||||
rescue IOError => ex
|
||||
warn "IOError when attempting to close socket connected "
|
||||
+ "to #{@host}:#{@port}: #{ex.inspect}"
|
||||
warn "IOError when attempting to close socket connected to #{@host}:#{@port}: #{ex.inspect}"
|
||||
end
|
||||
end
|
||||
@host = @port = nil
|
||||
|
|
|
@ -264,5 +264,15 @@ class TestConnection < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal 0, @con.primary_pool.checked_out.size
|
||||
end
|
||||
|
||||
should "show a proper exception message if an IOError is raised while closing a socket" do
|
||||
fake_socket = Mocha::Mock.new
|
||||
fake_socket.stubs(:close).raises(IOError.new)
|
||||
fake_socket.stub_everything
|
||||
TCPSocket.expects(:new).returns(fake_socket)
|
||||
|
||||
@con.primary_pool.checkout_new_socket
|
||||
assert_equal [], @con.primary_pool.close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue