minor: test update
This commit is contained in:
parent
540a58fed6
commit
a034eb2655
|
@ -1,7 +1,7 @@
|
||||||
require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'mongo')
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'mongo')
|
||||||
require 'logger'
|
require 'logger'
|
||||||
|
|
||||||
$con = Mongo::Connection.new
|
$con = Mongo::ReplSetConnection.new(['localhost', 30000], ['localhost', 30001], :read => :secondary, :refresh_mode => :async, :refresh_interval => 30)
|
||||||
$db = $con['foo']
|
$db = $con['foo']
|
||||||
|
|
||||||
class Load < Sinatra::Base
|
class Load < Sinatra::Base
|
||||||
|
@ -13,12 +13,9 @@ class Load < Sinatra::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
3.times do |n|
|
$db['test'].insert({:a => rand(1000)})
|
||||||
if (v=$db.eval("1 + #{n}")) != 1 + n
|
$db['test'].find({:a => {'$gt' => rand(2)}}, :read => :secondary).limit(2).to_a
|
||||||
STDERR << "#{1 + n} expected but got #{v}"
|
"ok"
|
||||||
raise StandardError, "#{1 + n} expected but got #{v}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue