From 68f19039d24229a3102895212615b59f31e9f798 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Tue, 6 Mar 2012 17:06:42 -0500 Subject: [PATCH] minor: updates for replica set tests, mock socket stubs --- test/replica_sets/read_preference_test.rb | 4 ++-- test/test_helper.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/replica_sets/read_preference_test.rb b/test/replica_sets/read_preference_test.rb index 34026ec..22eef8b 100644 --- a/test/replica_sets/read_preference_test.rb +++ b/test/replica_sets/read_preference_test.rb @@ -50,7 +50,7 @@ class ReadPreferenceTest < Test::Unit::TestCase @coll.save({:a => 20}, :safe => {:w => 2}) # Test that reads are going to secondary on ReplSetConnection - @secondary = Connection.new(@rs.host, @conn.read_pool.port, :slave_ok => true) + @secondary = Connection.new(@rs.host, @conn.secondary_pool.port, :slave_ok => true) queries_before = @secondary['admin'].command({:serverStatus => 1})['opcounters']['query'] @coll.find_one queries_after = @secondary['admin'].command({:serverStatus => 1})['opcounters']['query'] @@ -60,7 +60,7 @@ class ReadPreferenceTest < Test::Unit::TestCase @conn.refresh # Test that reads are only allowed from secondaries - assert_raise ConnectionFailure.new("Could not connect to a secondary for reading.") do + assert_raise ConnectionFailure.new("Could not checkout a socket.") do @coll.find_one end diff --git a/test/test_helper.rb b/test/test_helper.rb index bfd0acb..cf63c20 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -84,6 +84,7 @@ 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