Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON-4671 Skip client.bulk_write tests on Atlas Serverless #1807

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/asynchronous/test_client_bulk_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

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

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

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

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_batch_splits_if_num_operations_too_large(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand All @@ -115,6 +119,7 @@ async def test_batch_splits_if_num_operations_too_large(self):
self.assertEqual(first_event.operation_id, second_event.operation_id)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_batch_splits_if_ops_payload_too_large(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -147,6 +152,7 @@ async def test_batch_splits_if_ops_payload_too_large(self):
self.assertEqual(first_event.operation_id, second_event.operation_id)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
@async_client_context.require_failCommand_fail_point
async def test_collects_write_concern_errors_across_batches(self):
listener = OvertCommandListener()
Expand Down Expand Up @@ -190,6 +196,7 @@ async def test_collects_write_concern_errors_across_batches(self):
self.assertEqual(len(bulk_write_events), 2)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_collects_write_errors_across_batches_unordered(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -220,6 +227,7 @@ async def test_collects_write_errors_across_batches_unordered(self):
self.assertEqual(len(bulk_write_events), 2)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_collects_write_errors_across_batches_ordered(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -250,6 +258,7 @@ async def test_collects_write_errors_across_batches_ordered(self):
self.assertEqual(len(bulk_write_events), 1)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_handles_cursor_requiring_getMore(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -290,6 +299,7 @@ async def test_handles_cursor_requiring_getMore(self):
self.assertTrue(get_more_event)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
@async_client_context.require_no_standalone
async def test_handles_cursor_requiring_getMore_within_transaction(self):
listener = OvertCommandListener()
Expand Down Expand Up @@ -333,6 +343,7 @@ async def test_handles_cursor_requiring_getMore_within_transaction(self):
self.assertTrue(get_more_event)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
@async_client_context.require_failCommand_fail_point
async def test_handles_getMore_error(self):
listener = OvertCommandListener()
Expand Down Expand Up @@ -388,6 +399,7 @@ async def test_handles_getMore_error(self):
self.assertTrue(kill_cursors_event)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_returns_error_if_unacknowledged_too_large_insert(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -444,6 +456,7 @@ async def _setup_namespace_test_models(self):
return num_models, models

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_no_batch_splits_if_new_namespace_is_not_too_large(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -475,6 +488,7 @@ async def test_no_batch_splits_if_new_namespace_is_not_too_large(self):
self.assertEqual(event.command["nsInfo"][0]["ns"], "db.coll")

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_batch_splits_if_new_namespace_is_too_large(self):
listener = OvertCommandListener()
client = await async_rs_or_single_client(event_listeners=[listener])
Expand Down Expand Up @@ -513,6 +527,7 @@ async def test_batch_splits_if_new_namespace_is_too_large(self):
self.assertEqual(second_event.command["nsInfo"][0]["ns"], namespace)

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
async def test_returns_error_if_no_writes_can_be_added_to_ops(self):
client = await async_rs_or_single_client()
self.addAsyncCleanup(client.close)
Expand All @@ -531,6 +546,7 @@ async def test_returns_error_if_no_writes_can_be_added_to_ops(self):
await client.bulk_write(models=models)

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

@async_client_context.require_version_min(8, 0, 0, -24)
@async_client_context.require_no_serverless
@async_client_context.require_failCommand_fail_point
async def test_timeout_in_multi_batch_bulk_write(self):
_OVERHEAD = 500
Expand Down
3 changes: 2 additions & 1 deletion test/command_monitoring/unacknowledged-client-bulkWrite.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"schemaVersion": "1.7",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-delete-options.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite delete options",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
3 changes: 2 additions & 1 deletion test/crud/unified/client-bulkWrite-errorResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"schemaVersion": "1.12",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
3 changes: 2 additions & 1 deletion test/crud/unified/client-bulkWrite-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"schemaVersion": "1.21",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-mixed-namespaces.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite with mixed namespaces",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-options.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite top-level options",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-ordered.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite with ordered option",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-results.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite results",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-update-options.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite update options",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
5 changes: 3 additions & 2 deletions test/crud/unified/client-bulkWrite-update-pipeline.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"description": "client bulkWrite update pipeline",
"schemaVersion": "1.1",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"replicaset",
"sharded",
"load-balanced"
]
],
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"replicaset",
"sharded",
"load-balanced"
]
],
"serverless": "forbid"
}
],
"createEntities": [
Expand Down
10 changes: 6 additions & 4 deletions test/retryable_writes/unified/handshakeError.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "retryable writes handshake failures",
"schemaVersion": "1.3",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "4.2",
Expand Down Expand Up @@ -57,7 +57,8 @@
"description": "client.clientBulkWrite succeeds after retryable handshake network error",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"operations": [
Expand Down Expand Up @@ -165,7 +166,8 @@
"description": "client.clientBulkWrite succeeds after retryable handshake server error (ShutdownInProgress)",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"operations": [
Expand Down Expand Up @@ -2010,4 +2012,4 @@
]
}
]
}
}
6 changes: 4 additions & 2 deletions test/server_selection_logging/operation-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@
"description": "Successful client bulkWrite operation: log messages have operationIds",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"operations": [
Expand Down Expand Up @@ -304,7 +305,8 @@
"description": "Failed client bulkWrite operation: log messages have operationIds",
"runOnRequirements": [
{
"minServerVersion": "8.0"
"minServerVersion": "8.0",
"serverless": "forbid"
}
],
"operations": [
Expand Down
Loading
Loading