Skip to content

Commit 907ffbc

Browse files
committed
Fix test reqs
1 parent 9589b1f commit 907ffbc

8 files changed

+30
-0
lines changed

test/asynchronous/test_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,7 @@ class TestClientCSOTProse(AsyncIntegrationTest):
25972597
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#timeoutms-is-refreshed-for-each-handshake-command
25982598
@async_client_context.require_auth
25992599
@async_client_context.require_version_min(4, 4, -1)
2600+
@async_client_context.require_failCommand_appName
26002601
async def test_02_timeoutMS_refreshed_for_each_handshake_command(self):
26012602
listener = CMAPListener()
26022603

test/asynchronous/test_collection.py

+1
Original file line numberDiff line numberDiff line change
@@ -2281,6 +2281,7 @@ async def afind(*args, **kwargs):
22812281
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#1-multi-batch-inserts
22822282
@async_client_context.require_standalone
22832283
@async_client_context.require_version_min(4, 4, -1)
2284+
@async_client_context.require_failCommand_fail_point
22842285
async def test_01_multi_batch_inserts(self):
22852286
client = await self.async_single_client(read_preference=ReadPreference.PRIMARY_PREFERRED)
22862287
await client.db.coll.drop()

test/asynchronous/test_encryption.py

+6
Original file line numberDiff line numberDiff line change
@@ -3162,6 +3162,8 @@ async def asyncSetUp(self) -> None:
31623162
)
31633163

31643164
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#createdatakey
3165+
@async_client_context.require_failCommand_fail_point
3166+
@async_client_context.require_version_min(4, 4, -1)
31653167
async def test_01_create_data_key(self):
31663168
async with self.fail_point(
31673169
{
@@ -3178,6 +3180,8 @@ async def test_01_create_data_key(self):
31783180
self.assertEqual("insert", events[0].command_name)
31793181

31803182
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#encrypt
3183+
@async_client_context.require_failCommand_fail_point
3184+
@async_client_context.require_version_min(4, 4, -1)
31813185
async def test_02_encrypt(self):
31823186
data_key_id = await self.client_encryption.create_data_key("local")
31833187
self.assertEqual(4, data_key_id.subtype)
@@ -3200,6 +3204,8 @@ async def test_02_encrypt(self):
32003204
self.assertEqual("find", events[0].command_name)
32013205

32023206
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#decrypt
3207+
@async_client_context.require_failCommand_fail_point
3208+
@async_client_context.require_version_min(4, 4, -1)
32033209
async def test_03_decrypt(self):
32043210
data_key_id = await self.client_encryption.create_data_key("local")
32053211
self.assertEqual(4, data_key_id.subtype)

test/test_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -2553,6 +2553,7 @@ class TestClientCSOTProse(IntegrationTest):
25532553
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#timeoutms-is-refreshed-for-each-handshake-command
25542554
@client_context.require_auth
25552555
@client_context.require_version_min(4, 4, -1)
2556+
@client_context.require_failCommand_appName
25562557
def test_02_timeoutMS_refreshed_for_each_handshake_command(self):
25572558
listener = CMAPListener()
25582559

test/test_collection.py

+1
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,7 @@ def afind(*args, **kwargs):
22582258
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#1-multi-batch-inserts
22592259
@client_context.require_standalone
22602260
@client_context.require_version_min(4, 4, -1)
2261+
@client_context.require_failCommand_fail_point
22612262
def test_01_multi_batch_inserts(self):
22622263
client = self.single_client(read_preference=ReadPreference.PRIMARY_PREFERRED)
22632264
client.db.coll.drop()

test/test_encryption.py

+6
Original file line numberDiff line numberDiff line change
@@ -3144,6 +3144,8 @@ def setUp(self) -> None:
31443144
)
31453145

31463146
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#createdatakey
3147+
@client_context.require_failCommand_fail_point
3148+
@client_context.require_version_min(4, 4, -1)
31473149
def test_01_create_data_key(self):
31483150
with self.fail_point(
31493151
{
@@ -3160,6 +3162,8 @@ def test_01_create_data_key(self):
31603162
self.assertEqual("insert", events[0].command_name)
31613163

31623164
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#encrypt
3165+
@client_context.require_failCommand_fail_point
3166+
@client_context.require_version_min(4, 4, -1)
31633167
def test_02_encrypt(self):
31643168
data_key_id = self.client_encryption.create_data_key("local")
31653169
self.assertEqual(4, data_key_id.subtype)
@@ -3182,6 +3186,8 @@ def test_02_encrypt(self):
31823186
self.assertEqual("find", events[0].command_name)
31833187

31843188
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#decrypt
3189+
@client_context.require_failCommand_fail_point
3190+
@client_context.require_version_min(4, 4, -1)
31853191
def test_03_decrypt(self):
31863192
data_key_id = self.client_encryption.create_data_key("local")
31873193
self.assertEqual(4, data_key_id.subtype)

test/test_gridfs_bucket.py

+6
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ def test_gridfs_secondary_lazy(self):
529529
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#6-gridfs---upload
530530
class TestGridFsCSOT(IntegrationTest):
531531
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#uploads-via-openuploadstream-can-be-timed-out
532+
@client_context.require_failCommand_fail_point
533+
@client_context.require_version_min(4, 4, -1)
532534
def test_06_01_uploads_via_open_upload_stream_can_be_timed_out(self):
533535
self.client.db.fs.files.drop()
534536
self.client.db.fs.chunks.drop()
@@ -547,6 +549,8 @@ def test_06_01_uploads_via_open_upload_stream_can_be_timed_out(self):
547549
upload_stream.close()
548550

549551
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#aborting-an-upload-stream-can-be-timed-out
552+
@client_context.require_failCommand_fail_point
553+
@client_context.require_version_min(4, 4, -1)
550554
def test_06_02_aborting_an_upload_stream_can_be_timed_out(self):
551555
self.client.db.fs.files.drop()
552556
self.client.db.fs.chunks.drop()
@@ -565,6 +569,8 @@ def test_06_02_aborting_an_upload_stream_can_be_timed_out(self):
565569
upload_stream.abort()
566570

567571
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#7-gridfs---download
572+
@client_context.require_failCommand_fail_point
573+
@client_context.require_version_min(4, 4, -1)
568574
def test_07_gridfs_download_csot(self):
569575
self.client.db.fs.files.drop()
570576
self.client.db.fs.chunks.drop()

test/test_server_selection.py

+8
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def test_server_selector_bypassed(self):
204204
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#8-server-selection
205205
class TestServerSelectionCSOT(IntegrationTest):
206206
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#serverselectiontimeoutms-honored-if-timeoutms-is-not-set
207+
@client_context.require_version_min(4, 4, -1)
207208
def test_08_01_server_selection_timeoutMS_honored(self):
208209
client = self.single_client("mongodb://invalid/?serverSelectionTimeoutMS=10")
209210
with self.assertRaises(ServerSelectionTimeoutError):
@@ -215,6 +216,7 @@ def test_08_01_server_selection_timeoutMS_honored(self):
215216
self.assertLessEqual(start - end, 15)
216217

217218
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#timeoutms-honored-for-server-selection-if-its-lower-than-serverselectiontimeoutms
219+
@client_context.require_version_min(4, 4, -1)
218220
def test_08_02_timeoutMS_honored_for_server_selection_if_lower(self):
219221
client = self.single_client("mongodb://invalid/?timeoutMS=10&serverSelectionTimeoutMS=20")
220222
with self.assertRaises(ServerSelectionTimeoutError):
@@ -225,6 +227,7 @@ def test_08_02_timeoutMS_honored_for_server_selection_if_lower(self):
225227
self.assertLessEqual(start - end, 15)
226228

227229
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#serverselectiontimeoutms-honored-for-server-selection-if-its-lower-than-timeoutms
230+
@client_context.require_version_min(4, 4, -1)
228231
def test_08_03_serverselectiontimeoutms_honored_for_server_selection_if_lower(self):
229232
client = self.single_client("mongodb://invalid/?timeoutMS=20&serverSelectionTimeoutMS=10")
230233
with self.assertRaises(ServerSelectionTimeoutError):
@@ -236,6 +239,7 @@ def test_08_03_serverselectiontimeoutms_honored_for_server_selection_if_lower(se
236239
self.assertLessEqual(start - end, 15)
237240

238241
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#serverselectiontimeoutms-honored-for-server-selection-if-timeoutms0
242+
@client_context.require_version_min(4, 4, -1)
239243
def test_08_04_serverselectiontimeoutms_honored_for_server_selection_if_zero_timeoutms(self):
240244
client = self.single_client("mongodb://invalid/?timeoutMS=0&serverSelectionTimeoutMS=10")
241245
with self.assertRaises(ServerSelectionTimeoutError):
@@ -248,6 +252,8 @@ def test_08_04_serverselectiontimeoutms_honored_for_server_selection_if_zero_tim
248252

249253
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#timeoutms-honored-for-connection-handshake-commands-if-its-lower-than-serverselectiontimeoutms
250254
@client_context.require_auth
255+
@client_context.require_version_min(4, 4, -1)
256+
@client_context.require_failCommand_fail_point
251257
def test_08_05_timeoutms_honored_for_handshake_if_lower(self):
252258
with self.fail_point(
253259
{
@@ -270,6 +276,8 @@ def test_08_05_timeoutms_honored_for_handshake_if_lower(self):
270276

271277
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#serverselectiontimeoutms-honored-for-connection-handshake-commands-if-its-lower-than-timeoutms
272278
@client_context.require_auth
279+
@client_context.require_version_min(4, 4, -1)
280+
@client_context.require_failCommand_fail_point
273281
def test_08_06_serverSelectionTimeoutMS_honored_for_handshake_if_lower(self):
274282
with self.fail_point(
275283
{

0 commit comments

Comments
 (0)