From 0e716f170716c20498f2f14a2241cc95f9be7426 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 May 2020 13:10:14 +0200 Subject: [PATCH 1/2] PHPLIB-555: Sync spec tests for array filters --- .../bulkWrite-arrayFilters-clientError.json | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 tests/SpecTests/crud/bulkWrite-arrayFilters-clientError.json diff --git a/tests/SpecTests/crud/bulkWrite-arrayFilters-clientError.json b/tests/SpecTests/crud/bulkWrite-arrayFilters-clientError.json new file mode 100644 index 000000000..22e22f0ef --- /dev/null +++ b/tests/SpecTests/crud/bulkWrite-arrayFilters-clientError.json @@ -0,0 +1,110 @@ +{ + "runOn": [ + { + "maxServerVersion": "3.5.5" + } + ], + "data": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite on server that doesn't support arrayFilters", + "operations": [ + { + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "name": "updateOne", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.0.b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "options": { + "ordered": true + } + }, + "error": true + } + ], + "expectations": [] + }, + { + "description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op", + "operations": [ + { + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "name": "updateOne", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.0.b": 2 + } + } + } + }, + { + "name": "updateMany", + "arguments": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "options": { + "ordered": true + } + }, + "error": true + } + ], + "expectations": [] + } + ] +} From cb9d6f9adba1deba9f8c54198554f53be29f3043 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 May 2020 13:16:45 +0200 Subject: [PATCH 2/2] PHPLIB-551: Sync retryable write spec tests --- .../SpecTests/transactions/error-labels.json | 106 +++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/tests/SpecTests/transactions/error-labels.json b/tests/SpecTests/transactions/error-labels.json index fdc4b2f7f..2d3eed3cc 100644 --- a/tests/SpecTests/transactions/error-labels.json +++ b/tests/SpecTests/transactions/error-labels.json @@ -134,6 +134,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -223,6 +224,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -312,6 +314,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -462,7 +465,7 @@ } }, { - "description": "add TransientTransactionError label to connection errors", + "description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -497,6 +500,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -512,6 +516,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -534,6 +539,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -550,6 +556,7 @@ "TransientTransactionError" ], "errorLabelsOmit": [ + "RetryableWriteError", "UnknownTransactionCommitResult" ] } @@ -1098,6 +1105,103 @@ } } }, + { + "description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + }, + "operations": [ + { + "name": "startTransaction", + "object": "session0", + "arguments": { + "options": { + "writeConcern": { + "w": "majority" + } + } + } + }, + { + "name": "insertOne", + "object": "collection", + "arguments": { + "session": "session0", + "document": { + "_id": 1 + } + }, + "result": { + "errorLabelsContain": [], + "errorLabelsOmit": [ + "RetryableWriteError", + "TransientTransactionError", + "UnknownTransactionCommitResult" + ] + } + }, + { + "name": "abortTransaction", + "object": "session0" + } + ], + "expectations": [ + { + "command_started_event": { + "command": { + "insert": "test", + "documents": [ + { + "_id": 1 + } + ], + "ordered": true, + "readConcern": null, + "lsid": "session0", + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": true, + "autocommit": false + }, + "command_name": "insert", + "database_name": "transaction-tests" + } + }, + { + "command_started_event": { + "command": { + "abortTransaction": 1, + "lsid": "session0", + "txnNumber": { + "$numberLong": "1" + }, + "startTransaction": null, + "autocommit": false + }, + "command_name": "abortTransaction", + "database_name": "admin" + } + } + ], + "outcome": { + "collection": { + "data": [] + } + } + }, { "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed", "failPoint": {