File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ def test_cursors_get_closed_secondary_query
4141 assert_cursors_on_members ( :secondary )
4242 end
4343
44+ def test_intervening_query_secondary
45+ setup_client ( :primary )
46+ refresh_while_iterating ( :secondary )
47+ end
48+
4449 private
4550
4651 def setup_client ( read = :primary )
@@ -169,4 +174,25 @@ def assert_cursors_on_members(read=:primary)
169174 cursor_clone . next
170175 end
171176 end
177+
178+ def refresh_while_iterating ( read )
179+ set_read_client_and_tag ( read )
180+
181+ read_opts = { :read => read }
182+ read_opts [ :tag_sets ] = [ { :node => @tag } ]
183+ read_opts [ :batch_size ] = 2
184+ cursor = @coll . find ( { } , read_opts )
185+
186+ 2 . times { cursor . next }
187+ port = cursor . instance_variable_get ( :@pool ) . port
188+ host = cursor . instance_variable_get ( :@pool ) . host
189+ # Refresh connection
190+ @client . refresh
191+ assert_nothing_raised do
192+ cursor . next
193+ end
194+
195+ assert_equal port , cursor . instance_variable_get ( :@pool ) . port
196+ assert_equal host , cursor . instance_variable_get ( :@pool ) . host
197+ end
172198end
You can’t perform that action at this time.
0 commit comments