Skip to content

Commit 4dde301

Browse files
PYTHON-4671 Skip client.bulk_write tests on Atlas Serverless (#1807)
1 parent d6b896d commit 4dde301

18 files changed

+80
-28
lines changed

test/asynchronous/test_client_bulk_write.py

+17
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
class TestClientBulkWrite(AsyncIntegrationTest):
4949
@async_client_context.require_version_min(8, 0, 0, -24)
50+
@async_client_context.require_no_serverless
5051
async def test_returns_error_if_no_namespace_provided(self):
5152
models = [InsertOne(document={"a": "b"})]
5253
with self.assertRaises(InvalidOperation) as context:
@@ -57,6 +58,7 @@ async def test_returns_error_if_no_namespace_provided(self):
5758
)
5859

5960
@async_client_context.require_version_min(8, 0, 0, -24)
61+
@async_client_context.require_no_serverless
6062
async def test_handles_non_pymongo_error(self):
6163
with patch.object(
6264
_AsyncClientBulk, "write_command", return_value={"error": TypeError("mock type error")}
@@ -68,6 +70,7 @@ async def test_handles_non_pymongo_error(self):
6870
self.assertFalse(hasattr(context.exception.error, "details"))
6971

7072
@async_client_context.require_version_min(8, 0, 0, -24)
73+
@async_client_context.require_no_serverless
7174
async def test_formats_write_error_correctly(self):
7275
models = [
7376
InsertOne(namespace="db.coll", document={"_id": 1}),
@@ -90,6 +93,7 @@ async def asyncSetUp(self):
9093
self.max_message_size_bytes = await async_client_context.max_message_size_bytes
9194

9295
@async_client_context.require_version_min(8, 0, 0, -24)
96+
@async_client_context.require_no_serverless
9397
async def test_batch_splits_if_num_operations_too_large(self):
9498
listener = OvertCommandListener()
9599
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -115,6 +119,7 @@ async def test_batch_splits_if_num_operations_too_large(self):
115119
self.assertEqual(first_event.operation_id, second_event.operation_id)
116120

117121
@async_client_context.require_version_min(8, 0, 0, -24)
122+
@async_client_context.require_no_serverless
118123
async def test_batch_splits_if_ops_payload_too_large(self):
119124
listener = OvertCommandListener()
120125
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -147,6 +152,7 @@ async def test_batch_splits_if_ops_payload_too_large(self):
147152
self.assertEqual(first_event.operation_id, second_event.operation_id)
148153

149154
@async_client_context.require_version_min(8, 0, 0, -24)
155+
@async_client_context.require_no_serverless
150156
@async_client_context.require_failCommand_fail_point
151157
async def test_collects_write_concern_errors_across_batches(self):
152158
listener = OvertCommandListener()
@@ -190,6 +196,7 @@ async def test_collects_write_concern_errors_across_batches(self):
190196
self.assertEqual(len(bulk_write_events), 2)
191197

192198
@async_client_context.require_version_min(8, 0, 0, -24)
199+
@async_client_context.require_no_serverless
193200
async def test_collects_write_errors_across_batches_unordered(self):
194201
listener = OvertCommandListener()
195202
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -220,6 +227,7 @@ async def test_collects_write_errors_across_batches_unordered(self):
220227
self.assertEqual(len(bulk_write_events), 2)
221228

222229
@async_client_context.require_version_min(8, 0, 0, -24)
230+
@async_client_context.require_no_serverless
223231
async def test_collects_write_errors_across_batches_ordered(self):
224232
listener = OvertCommandListener()
225233
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -250,6 +258,7 @@ async def test_collects_write_errors_across_batches_ordered(self):
250258
self.assertEqual(len(bulk_write_events), 1)
251259

252260
@async_client_context.require_version_min(8, 0, 0, -24)
261+
@async_client_context.require_no_serverless
253262
async def test_handles_cursor_requiring_getMore(self):
254263
listener = OvertCommandListener()
255264
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -290,6 +299,7 @@ async def test_handles_cursor_requiring_getMore(self):
290299
self.assertTrue(get_more_event)
291300

292301
@async_client_context.require_version_min(8, 0, 0, -24)
302+
@async_client_context.require_no_serverless
293303
@async_client_context.require_no_standalone
294304
async def test_handles_cursor_requiring_getMore_within_transaction(self):
295305
listener = OvertCommandListener()
@@ -333,6 +343,7 @@ async def test_handles_cursor_requiring_getMore_within_transaction(self):
333343
self.assertTrue(get_more_event)
334344

335345
@async_client_context.require_version_min(8, 0, 0, -24)
346+
@async_client_context.require_no_serverless
336347
@async_client_context.require_failCommand_fail_point
337348
async def test_handles_getMore_error(self):
338349
listener = OvertCommandListener()
@@ -388,6 +399,7 @@ async def test_handles_getMore_error(self):
388399
self.assertTrue(kill_cursors_event)
389400

390401
@async_client_context.require_version_min(8, 0, 0, -24)
402+
@async_client_context.require_no_serverless
391403
async def test_returns_error_if_unacknowledged_too_large_insert(self):
392404
listener = OvertCommandListener()
393405
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -444,6 +456,7 @@ async def _setup_namespace_test_models(self):
444456
return num_models, models
445457

446458
@async_client_context.require_version_min(8, 0, 0, -24)
459+
@async_client_context.require_no_serverless
447460
async def test_no_batch_splits_if_new_namespace_is_not_too_large(self):
448461
listener = OvertCommandListener()
449462
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -475,6 +488,7 @@ async def test_no_batch_splits_if_new_namespace_is_not_too_large(self):
475488
self.assertEqual(event.command["nsInfo"][0]["ns"], "db.coll")
476489

477490
@async_client_context.require_version_min(8, 0, 0, -24)
491+
@async_client_context.require_no_serverless
478492
async def test_batch_splits_if_new_namespace_is_too_large(self):
479493
listener = OvertCommandListener()
480494
client = await async_rs_or_single_client(event_listeners=[listener])
@@ -513,6 +527,7 @@ async def test_batch_splits_if_new_namespace_is_too_large(self):
513527
self.assertEqual(second_event.command["nsInfo"][0]["ns"], namespace)
514528

515529
@async_client_context.require_version_min(8, 0, 0, -24)
530+
@async_client_context.require_no_serverless
516531
async def test_returns_error_if_no_writes_can_be_added_to_ops(self):
517532
client = await async_rs_or_single_client()
518533
self.addAsyncCleanup(client.close)
@@ -531,6 +546,7 @@ async def test_returns_error_if_no_writes_can_be_added_to_ops(self):
531546
await client.bulk_write(models=models)
532547

533548
@async_client_context.require_version_min(8, 0, 0, -24)
549+
@async_client_context.require_no_serverless
534550
@unittest.skipUnless(_HAVE_PYMONGOCRYPT, "pymongocrypt is not installed")
535551
async def test_returns_error_if_auto_encryption_configured(self):
536552
opts = AutoEncryptionOpts(
@@ -556,6 +572,7 @@ async def asyncSetUp(self):
556572
self.max_message_size_bytes = await async_client_context.max_message_size_bytes
557573

558574
@async_client_context.require_version_min(8, 0, 0, -24)
575+
@async_client_context.require_no_serverless
559576
@async_client_context.require_failCommand_fail_point
560577
async def test_timeout_in_multi_batch_bulk_write(self):
561578
_OVERHEAD = 500

test/command_monitoring/unacknowledged-client-bulkWrite.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"schemaVersion": "1.7",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-delete-options.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite delete options",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-errorResponse.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"schemaVersion": "1.12",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-errors.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"schemaVersion": "1.21",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-mixed-namespaces.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite with mixed namespaces",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-options.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite top-level options",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-ordered.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite with ordered option",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-results.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite results",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-update-options.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite update options",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/crud/unified/client-bulkWrite-update-pipeline.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"description": "client bulkWrite update pipeline",
3-
"schemaVersion": "1.1",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "8.0"
6+
"minServerVersion": "8.0",
7+
"serverless": "forbid"
78
}
89
],
910
"createEntities": [

test/retryable_writes/unified/client-bulkWrite-clientErrors.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"replicaset",
99
"sharded",
1010
"load-balanced"
11-
]
11+
],
12+
"serverless": "forbid"
1213
}
1314
],
1415
"createEntities": [

test/retryable_writes/unified/client-bulkWrite-serverErrors.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"replicaset",
99
"sharded",
1010
"load-balanced"
11-
]
11+
],
12+
"serverless": "forbid"
1213
}
1314
],
1415
"createEntities": [

test/retryable_writes/unified/handshakeError.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "retryable writes handshake failures",
3-
"schemaVersion": "1.3",
3+
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
66
"minServerVersion": "4.2",
@@ -57,7 +57,8 @@
5757
"description": "client.clientBulkWrite succeeds after retryable handshake network error",
5858
"runOnRequirements": [
5959
{
60-
"minServerVersion": "8.0"
60+
"minServerVersion": "8.0",
61+
"serverless": "forbid"
6162
}
6263
],
6364
"operations": [
@@ -165,7 +166,8 @@
165166
"description": "client.clientBulkWrite succeeds after retryable handshake server error (ShutdownInProgress)",
166167
"runOnRequirements": [
167168
{
168-
"minServerVersion": "8.0"
169+
"minServerVersion": "8.0",
170+
"serverless": "forbid"
169171
}
170172
],
171173
"operations": [
@@ -2010,4 +2012,4 @@
20102012
]
20112013
}
20122014
]
2013-
}
2015+
}

test/server_selection_logging/operation-id.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@
232232
"description": "Successful client bulkWrite operation: log messages have operationIds",
233233
"runOnRequirements": [
234234
{
235-
"minServerVersion": "8.0"
235+
"minServerVersion": "8.0",
236+
"serverless": "forbid"
236237
}
237238
],
238239
"operations": [
@@ -304,7 +305,8 @@
304305
"description": "Failed client bulkWrite operation: log messages have operationIds",
305306
"runOnRequirements": [
306307
{
307-
"minServerVersion": "8.0"
308+
"minServerVersion": "8.0",
309+
"serverless": "forbid"
308310
}
309311
],
310312
"operations": [

0 commit comments

Comments
 (0)