From 2690520afaab600c362ba2934528612abc5cf4a9 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Sat, 12 Mar 2011 17:48:35 -0500 Subject: [PATCH] RUBY-248 Verify query speed after failover --- test/replica_sets/query_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) 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