@@ -730,18 +730,23 @@ def _check_with_socket(self, *args, **kwargs):
730
730
if ismaster_count [0 ] in (1 , 3 ):
731
731
return IsMaster ({'ok' : 1 , 'maxWireVersion' : 6 }), 0
732
732
else :
733
- raise AutoReconnect ('mock monitor error' )
733
+ raise AutoReconnect (
734
+ 'mock monitor error #%s' % (ismaster_count [0 ],))
734
735
735
736
t = create_mock_topology (monitor_class = TestMonitor )
736
737
server = wait_for_master (t )
737
738
self .assertEqual (1 , ismaster_count [0 ])
738
739
self .assertEqual (SERVER_TYPE .Standalone ,
739
740
server .description .server_type )
740
741
741
- # Second ismaster call, then immediately the third .
742
+ # Second ismaster call.
742
743
t .request_check_all ()
743
- self .assertEqual (3 , ismaster_count [0 ])
744
+ # The third ismaster call (the immediate retry) happens sometime soon
745
+ # after the failed check triggered by request_check_all. Wait until
746
+ # the server becomes known again.
747
+ t .select_server (writable_server_selector , 0.250 )
744
748
self .assertEqual (SERVER_TYPE .Standalone , get_type (t , 'a' ))
749
+ self .assertEqual (3 , ismaster_count [0 ])
745
750
746
751
def test_internal_monitor_error (self ):
747
752
exception = AssertionError ('internal error' )
0 commit comments