minor: testing fixes, cleaning output
This commit is contained in:
parent
c992369918
commit
d42eee278b
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -99,7 +99,9 @@ class ConnectTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_connect_with_connection_string
|
||||
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
|
||||
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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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}"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user