File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,8 @@ async def test_retryable_reads_are_retried_on_the_same_implicit_session(self):
227227 retryReads = True ,
228228 )
229229
230+ await client .t .t .insert_one ({"x" : 1 })
231+
230232 commands = [
231233 ("aggregate" , lambda : client .t .t .count_documents ({})),
232234 ("aggregate" , lambda : client .t .t .aggregate ([{"$match" : {}}])),
@@ -250,13 +252,14 @@ async def test_retryable_reads_are_retried_on_the_same_implicit_session(self):
250252 await operation ()
251253
252254 # Assert that both events occurred on the same session.
253- lsids = [
254- event .command [ "lsid" ]
255+ command_docs = [
256+ event .command
255257 for event in listener .started_events
256258 if event .command_name == command_name
257259 ]
258- self .assertEqual (len (lsids ), 2 )
259- self .assertEqual (lsids [0 ], lsids [1 ])
260+ self .assertEqual (len (command_docs ), 2 )
261+ self .assertEqual (command_docs [0 ]["lsid" ], command_docs [1 ]["lsid" ])
262+ self .assertIsNot (command_docs [0 ], command_docs [1 ])
260263
261264
262265if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -225,6 +225,8 @@ def test_retryable_reads_are_retried_on_the_same_implicit_session(self):
225225 retryReads = True ,
226226 )
227227
228+ client .t .t .insert_one ({"x" : 1 })
229+
228230 commands = [
229231 ("aggregate" , lambda : client .t .t .count_documents ({})),
230232 ("aggregate" , lambda : client .t .t .aggregate ([{"$match" : {}}])),
@@ -248,13 +250,14 @@ def test_retryable_reads_are_retried_on_the_same_implicit_session(self):
248250 operation ()
249251
250252 # Assert that both events occurred on the same session.
251- lsids = [
252- event .command [ "lsid" ]
253+ command_docs = [
254+ event .command
253255 for event in listener .started_events
254256 if event .command_name == command_name
255257 ]
256- self .assertEqual (len (lsids ), 2 )
257- self .assertEqual (lsids [0 ], lsids [1 ])
258+ self .assertEqual (len (command_docs ), 2 )
259+ self .assertEqual (command_docs [0 ]["lsid" ], command_docs [1 ]["lsid" ])
260+ self .assertIsNot (command_docs [0 ], command_docs [1 ])
258261
259262
260263if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments