RUBY-248 Verify query speed after failover
This commit is contained in:
parent
6a46bf7aef
commit
2690520afa
|
@ -27,6 +27,8 @@ class ReplicaSetQueryTest < Test::Unit::TestCase
|
||||||
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}"
|
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "Benchmark before failover: #{benchmark_queries}"
|
||||||
|
|
||||||
RS.kill_primary
|
RS.kill_primary
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
@ -35,7 +37,15 @@ class ReplicaSetQueryTest < Test::Unit::TestCase
|
||||||
[20, 30, 40].each do |a|
|
[20, 30, 40].each do |a|
|
||||||
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}"
|
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "Benchmark after failover: #{benchmark_queries}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def benchmark_queries
|
||||||
|
t1 = Time.now
|
||||||
|
10000.times { @coll.find_one }
|
||||||
|
Time.now - t1
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue