|
1 |
| -# Copyright 2017 MongoDB, Inc. |
| 1 | +# Copyright 2017-present MongoDB, Inc. |
2 | 2 | #
|
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | # you may not use this file except in compliance with the License.
|
|
43 | 43 | from bson.int64 import Int64
|
44 | 44 | from bson.raw_bson import RawBSONDocument
|
45 | 45 | from bson.son import SON
|
46 |
| -from pymongo.asynchronous.mongo_client import AsyncMongoClient |
47 | 46 | from pymongo.errors import (
|
48 | 47 | AutoReconnect,
|
49 | 48 | ConnectionFailure,
|
@@ -226,47 +225,6 @@ async def test_supported_single_statement_no_retry(self):
|
226 | 225 | f"{msg} sent txnNumber with {event.command_name}",
|
227 | 226 | )
|
228 | 227 |
|
229 |
| - @async_client_context.require_no_standalone |
230 |
| - async def test_supported_single_statement_supported_cluster(self): |
231 |
| - for method, args, kwargs in retryable_single_statement_ops(self.db.retryable_write_test): |
232 |
| - msg = f"{method.__name__}(*{args!r}, **{kwargs!r})" |
233 |
| - self.listener.reset() |
234 |
| - await method(*args, **kwargs) |
235 |
| - commands_started = self.listener.started_events |
236 |
| - self.assertEqual(len(self.listener.succeeded_events), 1, msg) |
237 |
| - first_attempt = commands_started[0] |
238 |
| - self.assertIn( |
239 |
| - "lsid", |
240 |
| - first_attempt.command, |
241 |
| - f"{msg} sent no lsid with {first_attempt.command_name}", |
242 |
| - ) |
243 |
| - initial_session_id = first_attempt.command["lsid"] |
244 |
| - self.assertIn( |
245 |
| - "txnNumber", |
246 |
| - first_attempt.command, |
247 |
| - f"{msg} sent no txnNumber with {first_attempt.command_name}", |
248 |
| - ) |
249 |
| - |
250 |
| - # There should be no retry when the failpoint is not active. |
251 |
| - if async_client_context.is_mongos or not async_client_context.test_commands_enabled: |
252 |
| - self.assertEqual(len(commands_started), 1) |
253 |
| - continue |
254 |
| - |
255 |
| - initial_transaction_id = first_attempt.command["txnNumber"] |
256 |
| - retry_attempt = commands_started[1] |
257 |
| - self.assertIn( |
258 |
| - "lsid", |
259 |
| - retry_attempt.command, |
260 |
| - f"{msg} sent no lsid with {first_attempt.command_name}", |
261 |
| - ) |
262 |
| - self.assertEqual(retry_attempt.command["lsid"], initial_session_id, msg) |
263 |
| - self.assertIn( |
264 |
| - "txnNumber", |
265 |
| - retry_attempt.command, |
266 |
| - f"{msg} sent no txnNumber with {first_attempt.command_name}", |
267 |
| - ) |
268 |
| - self.assertEqual(retry_attempt.command["txnNumber"], initial_transaction_id, msg) |
269 |
| - |
270 | 228 | async def test_supported_single_statement_unsupported_cluster(self):
|
271 | 229 | if async_client_context.is_rs or async_client_context.is_mongos:
|
272 | 230 | raise SkipTest("This cluster supports retryable writes")
|
|
0 commit comments