From 566d1a844f9c284953ce85ac5336ece59fb5305e Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Wed, 12 Oct 2011 10:51:57 -0400 Subject: [PATCH] minor: test to reproduce CURSOR_NOT_FOUND error with async refresh --- test/replica_sets/read_preference_test.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/replica_sets/read_preference_test.rb b/test/replica_sets/read_preference_test.rb index 59a9b3c..bd8801e 100644 --- a/test/replica_sets/read_preference_test.rb +++ b/test/replica_sets/read_preference_test.rb @@ -5,11 +5,22 @@ require './test/replica_sets/rs_test_helper' class ReadPreferenceTest < Test::Unit::TestCase include Mongo - #def setup - # @conn = ReplSetConnection.new([RS.host, RS.ports[0], RS.host, RS.ports[1]], :read => :secondary, :pool_size => 50) - # @db = @conn.db(MONGO_TEST_DB) - # @db.drop_collection("test-sets") - #end + def test_long_write_with_async_refresh + conn = ReplSetConnection.new([RS.host, RS.ports[0], RS.host, RS.ports[1]], + :read => :secondary, :pool_size => 50, + :refresh_mode => :async, :refresh_interval => 5) + + db = conn.db(MONGO_TEST_DB) + db.drop_collection("test-sets") + col = @db['mongo-test'] + + 100000.times do |n| + col.insert({:n => n, :str => "0000000000"}) + end + + assert col.find.to_a + col.remove + end # TODO: enable this once we enable reads from tags. # def test_query_tagged