Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

RUBY-505 test on intervening query during cursor iteration

  • Loading branch information...
commit a33dec99d5ca8e81ac8e776113fcf8462ab1e877 1 parent 3b31742
@estolfo estolfo authored TylerBrock committed
Showing with 26 additions and 0 deletions.
  1. +26 −0 test/replica_set/cursor_test.rb
View
26 test/replica_set/cursor_test.rb
@@ -41,6 +41,11 @@ def test_cursors_get_closed_secondary_query
assert_cursors_on_members(:secondary)
end
+ def test_intervening_query_secondary
+ setup_client(:primary)
+ refresh_while_iterating(:secondary)
+ end
+
private
def setup_client(read=:primary)
@@ -169,4 +174,25 @@ def assert_cursors_on_members(read=:primary)
cursor_clone.next
end
end
+
+ def refresh_while_iterating(read)
+ set_read_client_and_tag(read)
+
+ read_opts = {:read => read}
+ read_opts[:tag_sets] = [{:node => @tag}]
+ read_opts[:batch_size] = 2
+ cursor = @coll.find({}, read_opts)
+
+ 2.times { cursor.next }
+ port = cursor.instance_variable_get(:@pool).port
+ host = cursor.instance_variable_get(:@pool).host
+ # Refresh connection
+ @client.refresh
+ assert_nothing_raised do
+ cursor.next
+ end
+
+ assert_equal port, cursor.instance_variable_get(:@pool).port
+ assert_equal host, cursor.instance_variable_get(:@pool).host
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.