RUBY-416 unit test stub fix
This commit is contained in:
parent
06bc50fe46
commit
0ae757c69b
|
@ -19,7 +19,7 @@ module Mongo
|
|||
class Pool
|
||||
PING_ATTEMPTS = 6
|
||||
MAX_PING_TIME = 1_000_000
|
||||
PRUNE_INTERVAL = 10000
|
||||
PRUNE_INTERVAL = 10_000
|
||||
|
||||
attr_accessor :host, :port, :address,
|
||||
:size, :timeout, :safe, :checked_out, :connection
|
||||
|
|
|
@ -48,7 +48,7 @@ class PoolTest < Test::Unit::TestCase
|
|||
assert_equal 10, @pool.instance_variable_get(:@threads_to_sockets).size
|
||||
|
||||
# Thread-socket pool
|
||||
1000.times do
|
||||
10000.times do
|
||||
@pool.checkin(@pool.checkout)
|
||||
end
|
||||
|
||||
|
|
|
@ -84,7 +84,6 @@ class Test::Unit::TestCase
|
|||
socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||||
socket.stubs(:close)
|
||||
socket.stubs(:closed?)
|
||||
socket.stubs(:pool)
|
||||
socket
|
||||
end
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ class ReadTest < Test::Unit::TestCase
|
|||
read_pool = stub(:checkin => true)
|
||||
@con.stubs(:read_pool).returns(read_pool)
|
||||
primary_pool = stub(:checkin => true)
|
||||
sock.stubs(:pool).returns(primary_pool)
|
||||
@con.stubs(:primary_pool).returns(primary_pool)
|
||||
@con.expects(:checkout_reader).returns(sock)
|
||||
@con.expects(:receive_message).with do |o, m, l, s, c, r|
|
||||
|
@ -89,6 +90,7 @@ class ReadTest < Test::Unit::TestCase
|
|||
@cursor = @col.find({:a => 1}, :read => :primary)
|
||||
sock = new_mock_socket
|
||||
primary_pool = stub(:checkin => true)
|
||||
sock.stubs(:pool).returns(primary_pool)
|
||||
@con.stubs(:primary_pool).returns(primary_pool)
|
||||
@con.expects(:checkout_writer).returns(sock)
|
||||
@con.expects(:receive_message).with do |o, m, l, s, c, r|
|
||||
|
|
Loading…
Reference in New Issue