Skip to content

Commit e89369e

Browse files
committed
PYTHON-4919 Remove redundant test
1 parent 2843e66 commit e89369e

File tree

2 files changed

+2
-86
lines changed

2 files changed

+2
-86
lines changed

test/asynchronous/test_retryable_writes.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 MongoDB, Inc.
1+
# Copyright 2017-present MongoDB, Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@
4343
from bson.int64 import Int64
4444
from bson.raw_bson import RawBSONDocument
4545
from bson.son import SON
46-
from pymongo.asynchronous.mongo_client import AsyncMongoClient
4746
from pymongo.errors import (
4847
AutoReconnect,
4948
ConnectionFailure,
@@ -226,47 +225,6 @@ async def test_supported_single_statement_no_retry(self):
226225
f"{msg} sent txnNumber with {event.command_name}",
227226
)
228227

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-
270228
async def test_supported_single_statement_unsupported_cluster(self):
271229
if async_client_context.is_rs or async_client_context.is_mongos:
272230
raise SkipTest("This cluster supports retryable writes")

test/test_retryable_writes.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 MongoDB, Inc.
1+
# Copyright 2017-present MongoDB, Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -65,7 +65,6 @@
6565
UpdateMany,
6666
UpdateOne,
6767
)
68-
from pymongo.synchronous.mongo_client import MongoClient
6968
from pymongo.write_concern import WriteConcern
7069

7170
_IS_SYNC = True
@@ -226,47 +225,6 @@ def test_supported_single_statement_no_retry(self):
226225
f"{msg} sent txnNumber with {event.command_name}",
227226
)
228227

229-
@client_context.require_no_standalone
230-
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-
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 client_context.is_mongos or not 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-
270228
def test_supported_single_statement_unsupported_cluster(self):
271229
if client_context.is_rs or client_context.is_mongos:
272230
raise SkipTest("This cluster supports retryable writes")

0 commit comments

Comments
 (0)