diff --git a/test/replica_sets/query_test.rb b/test/replica_sets/query_test.rb index 5713e66..127f1f7 100644 --- a/test/replica_sets/query_test.rb +++ b/test/replica_sets/query_test.rb @@ -27,6 +27,8 @@ 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}" + RS.kill_primary results = [] @@ -35,7 +37,15 @@ class ReplicaSetQueryTest < Test::Unit::TestCase [20, 30, 40].each do |a| assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}" end + + puts "Benchmark after failover: #{benchmark_queries}" end end + def benchmark_queries + t1 = Time.now + 10000.times { @coll.find_one } + Time.now - t1 + end + end