diff --git a/lib/mongo/util/uri_parser.rb b/lib/mongo/util/uri_parser.rb index 7af63cc..a0154f7 100644 --- a/lib/mongo/util/uri_parser.rb +++ b/lib/mongo/util/uri_parser.rb @@ -139,11 +139,11 @@ module Mongo if @connect == 'direct' opts[:slave_ok] = true else - opts[:read_secondary] = true + opts[:read] = :secondary end end - opts[:rs_name] = @replicaset if @replicaset + opts[:name] = @replicaset if @replicaset opts end diff --git a/test/connection_test.rb b/test/connection_test.rb index 713ae42..819deb8 100644 --- a/test/connection_test.rb +++ b/test/connection_test.rb @@ -175,8 +175,8 @@ class TestConnection < Test::Unit::TestCase end seeds = @conn.seeds assert_equal 2, seeds.length - assert_equal ['foo', 27017], nodes[0] - assert_equal ['bar', 27018], nodes[1] + assert_equal ['foo', 27017], seeds[0] + assert_equal ['bar', 27018], seeds[1] end def test_fsync_lock diff --git a/test/replica_sets/complex_connect_test.rb b/test/replica_sets/complex_connect_test.rb index e418e9e..e2f894a 100644 --- a/test/replica_sets/complex_connect_test.rb +++ b/test/replica_sets/complex_connect_test.rb @@ -15,11 +15,11 @@ class ComplexConnectTest < Test::Unit::TestCase def test_complex_connect primary = Connection.new(@rs.host, @rs.ports[0]) - @conn = ReplSetConnection.new( - [@rs.host, @rs.ports[2]], - [@rs.host, @rs.ports[1]], - [@rs.host, @rs.ports[0]] - ) + @conn = ReplSetConnection.new([ + "#{@rs.host}:#{@rs.ports[2]}", + "#{@rs.host}:#{@rs.ports[1]}", + "#{@rs.host}:#{@rs.ports[0]}", + ]) @conn['test']['foo'].insert({:a => 1}) assert @conn['test']['foo'].find_one diff --git a/test/replica_sets/connect_test.rb b/test/replica_sets/connect_test.rb index a0b915e..a608873 100644 --- a/test/replica_sets/connect_test.rb +++ b/test/replica_sets/connect_test.rb @@ -99,7 +99,9 @@ class ConnectTest < Test::Unit::TestCase end def test_connect_with_connection_string - @conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name}") + silently do + @conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name}") + end assert @conn.is_a?(ReplSetConnection) assert @conn.connected? end @@ -117,7 +119,9 @@ class ConnectTest < Test::Unit::TestCase end def test_connect_with_full_connection_string - @conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name};safe=true;w=2;fsync=true;slaveok=true") + silently do + @conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name};safe=true;w=2;fsync=true;slaveok=true") + end assert @conn.is_a?(ReplSetConnection) assert @conn.connected? assert_equal 2, @conn.safe[:w] diff --git a/test/replica_sets/query_test.rb b/test/replica_sets/query_test.rb index 22953ad..0b971a1 100644 --- a/test/replica_sets/query_test.rb +++ b/test/replica_sets/query_test.rb @@ -26,7 +26,7 @@ class ReplicaSetQueryTest < Test::Unit::TestCase assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}" end - puts "Benchmark before failover: #{benchmark_queries}" + #puts "Benchmark before failover: #{benchmark_queries}" @rs.kill_primary @@ -37,7 +37,7 @@ class ReplicaSetQueryTest < Test::Unit::TestCase assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}" end - puts "Benchmark after failover: #{benchmark_queries}" + #puts "Benchmark after failover: #{benchmark_queries}" end end diff --git a/test/replica_sets/read_preference_test.rb b/test/replica_sets/read_preference_test.rb index 4596571..ff1c62f 100644 --- a/test/replica_sets/read_preference_test.rb +++ b/test/replica_sets/read_preference_test.rb @@ -87,7 +87,7 @@ class ReadPreferenceTest < Test::Unit::TestCase results = [] rescue_connection_failure do - puts "@coll.find().each" + #puts "@coll.find().each" @coll.find.each {|r| results << r} [20, 30, 40].each do |a| assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}" diff --git a/test/replica_sets/refresh_test.rb b/test/replica_sets/refresh_test.rb index 8c32f40..9e84485 100644 --- a/test/replica_sets/refresh_test.rb +++ b/test/replica_sets/refresh_test.rb @@ -10,9 +10,10 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase def teardown @rs.restart_killed_nodes - @conn.close if @conn + @conn.close if defined?(@conn) end +=begin def test_connect_speed Benchmark.bm do |x| x.report("Connect") do @@ -31,6 +32,7 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase end end end +=end def test_connect_and_manual_refresh_with_secondaries_down @rs.kill_all_secondaries