From e40902b5a6444a82d7829c4068f82e5d87438052 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 26 Mar 2025 22:04:20 -0500 Subject: [PATCH] PYTHON-4942 & PYTHON-4936 Test that isClientError considers network errors and operations may be an empty array --- .../unified/estimatedDocumentCount.json | 4 +- .../expectedError-isClientError.json | 74 +++++++++++++++++++ .../valid-pass/operation-empty_array.json | 10 +++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 test/unified-test-format/valid-pass/expectedError-isClientError.json create mode 100644 test/unified-test-format/valid-pass/operation-empty_array.json diff --git a/test/retryable_reads/unified/estimatedDocumentCount.json b/test/retryable_reads/unified/estimatedDocumentCount.json index 75a676b9b6..2ee29f6799 100644 --- a/test/retryable_reads/unified/estimatedDocumentCount.json +++ b/test/retryable_reads/unified/estimatedDocumentCount.json @@ -195,7 +195,7 @@ "object": "collection1", "name": "estimatedDocumentCount", "expectError": { - "isError": true + "isClientError": true } } ], @@ -241,7 +241,7 @@ "object": "collection0", "name": "estimatedDocumentCount", "expectError": { - "isError": true + "isClientError": true } } ], diff --git a/test/unified-test-format/valid-pass/expectedError-isClientError.json b/test/unified-test-format/valid-pass/expectedError-isClientError.json new file mode 100644 index 0000000000..9c6beda588 --- /dev/null +++ b/test/unified-test-format/valid-pass/expectedError-isClientError.json @@ -0,0 +1,74 @@ +{ + "description": "expectedError-isClientError", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "single", + "replicaset" + ] + }, + { + "minServerVersion": "4.1.7", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + } + ], + "tests": [ + { + "description": "isClientError considers network errors", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "ping" + ], + "closeConnection": true + } + } + } + }, + { + "name": "runCommand", + "object": "database0", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ] + } + ] +} diff --git a/test/unified-test-format/valid-pass/operation-empty_array.json b/test/unified-test-format/valid-pass/operation-empty_array.json new file mode 100644 index 0000000000..93b25c983c --- /dev/null +++ b/test/unified-test-format/valid-pass/operation-empty_array.json @@ -0,0 +1,10 @@ +{ + "description": "operation-empty_array", + "schemaVersion": "1.0", + "tests": [ + { + "description": "Empty operations array", + "operations": [] + } + ] +}