diff --git a/.evergreen/remove-unimplemented-tests.sh b/.evergreen/remove-unimplemented-tests.sh index 9e049de318..d81713794d 100755 --- a/.evergreen/remove-unimplemented-tests.sh +++ b/.evergreen/remove-unimplemented-tests.sh @@ -7,6 +7,7 @@ rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.j rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918 rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918 rm $PYMONGO/test/client-side-encryption/spec/unified/client-bulkWrite-qe.json # PYTHON-4929 +rm $PYMONGO/test/sessions/snapshot-sessions.json # PYTHON-5559 # Python doesn't implement DRIVERS-3064 rm $PYMONGO/test/collection_management/listCollections-rawdata.json @@ -50,4 +51,7 @@ rm $PYMONGO/test/csot/override-database-timeoutMS.json # PYTHON-2943 - Socks5 Proxy Support rm $PYMONGO/test/uri_options/proxy-options.json +# PYTHON-5517 - Avoid clearing the connection pool when the server connection rate limiter triggers +rm $PYMONGO/test/discovery_and_monitoring/unified/backpressure-*.json + echo "Done removing unimplemented tests" diff --git a/.evergreen/spec-patch/PYTHON-5517.patch b/.evergreen/spec-patch/PYTHON-5517.patch index bc2e194271..adf453fd1f 100644 --- a/.evergreen/spec-patch/PYTHON-5517.patch +++ b/.evergreen/spec-patch/PYTHON-5517.patch @@ -1,447 +1,5 @@ -diff --git a/test/connection_monitoring/pool-create-min-size-error.json b/test/connection_monitoring/pool-create-min-size-error.json -index 1c744b85..5c8ad02d 100644 ---- a/test/connection_monitoring/pool-create-min-size-error.json -+++ b/test/connection_monitoring/pool-create-min-size-error.json -@@ -17,7 +17,7 @@ - "isMaster", - "hello" - ], -- "closeConnection": true, -+ "errorCode": 91, - "appName": "poolCreateMinSizeErrorTest" - } - }, -diff --git a/test/discovery_and_monitoring/unified/backpressure-network-error-fail.json b/test/discovery_and_monitoring/unified/backpressure-network-error-fail.json -new file mode 100644 -index 00000000..f41b7645 ---- /dev/null -+++ b/test/discovery_and_monitoring/unified/backpressure-network-error-fail.json -@@ -0,0 +1,140 @@ -+{ -+ "description": "backpressure-network-error-fail", -+ "schemaVersion": "1.17", -+ "runOnRequirements": [ -+ { -+ "minServerVersion": "4.4", -+ "serverless": "forbid", -+ "topologies": [ -+ "single", -+ "replicaset", -+ "sharded" -+ ] -+ } -+ ], -+ "createEntities": [ -+ { -+ "client": { -+ "id": "setupClient", -+ "useMultipleMongoses": false -+ } -+ } -+ ], -+ "initialData": [ -+ { -+ "collectionName": "backpressure-network-error-fail", -+ "databaseName": "sdam-tests", -+ "documents": [ -+ { -+ "_id": 1 -+ }, -+ { -+ "_id": 2 -+ } -+ ] -+ } -+ ], -+ "tests": [ -+ { -+ "description": "apply backpressure on network connection errors during connection establishment", -+ "operations": [ -+ { -+ "name": "createEntities", -+ "object": "testRunner", -+ "arguments": { -+ "entities": [ -+ { -+ "client": { -+ "id": "client", -+ "useMultipleMongoses": false, -+ "observeEvents": [ -+ "serverHeartbeatSucceededEvent", -+ "poolClearedEvent" -+ ], -+ "uriOptions": { -+ "retryWrites": false, -+ "heartbeatFrequencyMS": 1000000, -+ "serverMonitoringMode": "poll", -+ "appname": "backpressureNetworkErrorFailTest" -+ } -+ } -+ }, -+ { -+ "database": { -+ "id": "database", -+ "client": "client", -+ "databaseName": "sdam-tests" -+ } -+ }, -+ { -+ "collection": { -+ "id": "collection", -+ "database": "database", -+ "collectionName": "backpressure-network-error-fail" -+ } -+ } -+ ] -+ } -+ }, -+ { -+ "name": "waitForEvent", -+ "object": "testRunner", -+ "arguments": { -+ "client": "client", -+ "event": { -+ "serverHeartbeatSucceededEvent": {} -+ }, -+ "count": 1 -+ } -+ }, -+ { -+ "name": "failPoint", -+ "object": "testRunner", -+ "arguments": { -+ "client": "setupClient", -+ "failPoint": { -+ "configureFailPoint": "failCommand", -+ "mode": "alwaysOn", -+ "data": { -+ "failCommands": [ -+ "isMaster", -+ "hello" -+ ], -+ "appName": "backpressureNetworkErrorFailTest", -+ "closeConnection": true -+ } -+ } -+ } -+ }, -+ { -+ "name": "insertMany", -+ "object": "collection", -+ "arguments": { -+ "documents": [ -+ { -+ "_id": 3 -+ }, -+ { -+ "_id": 4 -+ } -+ ] -+ }, -+ "expectError": { -+ "isError": true, -+ "errorLabelsContain": [ -+ "SystemOverloadedError", -+ "RetryableError" -+ ] -+ } -+ } -+ ], -+ "expectEvents": [ -+ { -+ "client": "client", -+ "eventType": "cmap", -+ "events": [] -+ } -+ ] -+ } -+ ] -+} -diff --git a/test/discovery_and_monitoring/unified/backpressure-network-timeout-fail.json b/test/discovery_and_monitoring/unified/backpressure-network-timeout-fail.json -new file mode 100644 -index 00000000..a97c7a32 ---- /dev/null -+++ b/test/discovery_and_monitoring/unified/backpressure-network-timeout-fail.json -@@ -0,0 +1,143 @@ -+{ -+ "description": "backpressure-network-timeout-error", -+ "schemaVersion": "1.17", -+ "runOnRequirements": [ -+ { -+ "minServerVersion": "4.4", -+ "serverless": "forbid", -+ "topologies": [ -+ "single", -+ "replicaset", -+ "sharded" -+ ] -+ } -+ ], -+ "createEntities": [ -+ { -+ "client": { -+ "id": "setupClient", -+ "useMultipleMongoses": false -+ } -+ } -+ ], -+ "initialData": [ -+ { -+ "collectionName": "backpressure-network-timeout-error", -+ "databaseName": "sdam-tests", -+ "documents": [ -+ { -+ "_id": 1 -+ }, -+ { -+ "_id": 2 -+ } -+ ] -+ } -+ ], -+ "tests": [ -+ { -+ "description": "apply backpressure on network timeout error during connection establishment", -+ "operations": [ -+ { -+ "name": "createEntities", -+ "object": "testRunner", -+ "arguments": { -+ "entities": [ -+ { -+ "client": { -+ "id": "client", -+ "useMultipleMongoses": false, -+ "observeEvents": [ -+ "serverDescriptionChangedEvent", -+ "poolClearedEvent" -+ ], -+ "uriOptions": { -+ "retryWrites": false, -+ "heartbeatFrequencyMS": 1000000, -+ "appname": "backpressureNetworkTimeoutErrorTest", -+ "serverMonitoringMode": "poll", -+ "connectTimeoutMS": 250, -+ "socketTimeoutMS": 250 -+ } -+ } -+ }, -+ { -+ "database": { -+ "id": "database", -+ "client": "client", -+ "databaseName": "sdam-tests" -+ } -+ }, -+ { -+ "collection": { -+ "id": "collection", -+ "database": "database", -+ "collectionName": "backpressure-network-timeout-error" -+ } -+ } -+ ] -+ } -+ }, -+ { -+ "name": "waitForEvent", -+ "object": "testRunner", -+ "arguments": { -+ "client": "client", -+ "event": { -+ "serverDescriptionChangedEvent": {} -+ }, -+ "count": 1 -+ } -+ }, -+ { -+ "name": "failPoint", -+ "object": "testRunner", -+ "arguments": { -+ "client": "setupClient", -+ "failPoint": { -+ "configureFailPoint": "failCommand", -+ "mode": "alwaysOn", -+ "data": { -+ "failCommands": [ -+ "isMaster", -+ "hello" -+ ], -+ "blockConnection": true, -+ "blockTimeMS": 500, -+ "appName": "backpressureNetworkTimeoutErrorTest" -+ } -+ } -+ } -+ }, -+ { -+ "name": "insertMany", -+ "object": "collection", -+ "arguments": { -+ "documents": [ -+ { -+ "_id": 3 -+ }, -+ { -+ "_id": 4 -+ } -+ ] -+ }, -+ "expectError": { -+ "isError": true, -+ "errorLabelsContain": [ -+ "SystemOverloadedError", -+ "RetryableError" -+ ] -+ } -+ } -+ ], -+ "expectEvents": [ -+ { -+ "client": "client", -+ "eventType": "cmap", -+ "events": [] -+ } -+ ] -+ } -+ ] -+} -diff --git a/test/discovery_and_monitoring/unified/backpressure-server-description-unchanged-on-min-pool-size-population-error.json b/test/discovery_and_monitoring/unified/backpressure-server-description-unchanged-on-min-pool-size-population-error.json -new file mode 100644 -index 00000000..35a49c13 ---- /dev/null -+++ b/test/discovery_and_monitoring/unified/backpressure-server-description-unchanged-on-min-pool-size-population-error.json -@@ -0,0 +1,106 @@ -+{ -+ "description": "backpressure-server-description-unchanged-on-min-pool-size-population-error", -+ "schemaVersion": "1.17", -+ "runOnRequirements": [ -+ { -+ "minServerVersion": "4.4", -+ "serverless": "forbid", -+ "topologies": [ -+ "single" -+ ] -+ } -+ ], -+ "createEntities": [ -+ { -+ "client": { -+ "id": "setupClient", -+ "useMultipleMongoses": false -+ } -+ } -+ ], -+ "tests": [ -+ { -+ "description": "the server description is not changed on handshake error during minPoolSize population", -+ "operations": [ -+ { -+ "name": "createEntities", -+ "object": "testRunner", -+ "arguments": { -+ "entities": [ -+ { -+ "client": { -+ "id": "client", -+ "observeEvents": [ -+ "serverDescriptionChangedEvent", -+ "connectionClosedEvent" -+ ], -+ "uriOptions": { -+ "appname": "authErrorTest", -+ "minPoolSize": 5, -+ "maxConnecting": 1, -+ "serverMonitoringMode": "poll", -+ "heartbeatFrequencyMS": 1000000 -+ } -+ } -+ } -+ ] -+ } -+ }, -+ { -+ "name": "failPoint", -+ "object": "testRunner", -+ "arguments": { -+ "client": "setupClient", -+ "failPoint": { -+ "configureFailPoint": "failCommand", -+ "mode": { -+ "skip": 1 -+ }, -+ "data": { -+ "failCommands": [ -+ "hello", -+ "isMaster" -+ ], -+ "appName": "authErrorTest", -+ "closeConnection": true -+ } -+ } -+ } -+ }, -+ { -+ "name": "waitForEvent", -+ "object": "testRunner", -+ "arguments": { -+ "client": "client", -+ "event": { -+ "serverDescriptionChangedEvent": {} -+ }, -+ "count": 1 -+ } -+ }, -+ { -+ "name": "waitForEvent", -+ "object": "testRunner", -+ "arguments": { -+ "client": "client", -+ "event": { -+ "connectionClosedEvent": {} -+ }, -+ "count": 1 -+ } -+ } -+ ], -+ "expectEvents": [ -+ { -+ "client": "client", -+ "eventType": "sdam", -+ "events": [ -+ { -+ "serverDescriptionChangedEvent": {} -+ } -+ ] -+ } -+ ] -+ } -+ ] -+} -diff --git a/test/load_balancer/sdam-error-handling.json b/test/load_balancer/sdam-error-handling.json -index 5892dcac..41bc90be 100644 ---- a/test/load_balancer/sdam-error-handling.json -+++ b/test/load_balancer/sdam-error-handling.json -@@ -282,7 +282,7 @@ - "isMaster", - "hello" - ], -- "closeConnection": true, -+ "errorCode": 11600, - "appName": "lbSDAMErrorTestClient" - } - } -@@ -297,7 +297,7 @@ - } - }, - "expectError": { -- "isClientError": true -+ "isError": true - } - } - ], diff --git a/test/discovery_and_monitoring/errors/error_handling_handshake.json b/test/discovery_and_monitoring/errors/error_handling_handshake.json -index 56ca7d11..bf83f46f 100644 +index 56ca7d113..bf83f46f6 100644 --- a/test/discovery_and_monitoring/errors/error_handling_handshake.json +++ b/test/discovery_and_monitoring/errors/error_handling_handshake.json @@ -97,14 +97,22 @@ diff --git a/test/connection_monitoring/pool-create-min-size-error.json b/test/connection_monitoring/pool-create-min-size-error.json index 1c744b850c..5c8ad02dbd 100644 --- a/test/connection_monitoring/pool-create-min-size-error.json +++ b/test/connection_monitoring/pool-create-min-size-error.json @@ -17,7 +17,7 @@ "isMaster", "hello" ], - "closeConnection": true, + "errorCode": 91, "appName": "poolCreateMinSizeErrorTest" } }, diff --git a/test/discovery_and_monitoring/unified/minPoolSize-error.json b/test/discovery_and_monitoring/unified/minPoolSize-error.json index bd9e9fcdec..0ce2bdd6c1 100644 --- a/test/discovery_and_monitoring/unified/minPoolSize-error.json +++ b/test/discovery_and_monitoring/unified/minPoolSize-error.json @@ -27,7 +27,7 @@ ], "tests": [ { - "description": "Network error on minPoolSize background creation", + "description": "Server error on minPoolSize background creation", "operations": [ { "name": "failPoint", @@ -45,7 +45,7 @@ "isMaster" ], "appName": "SDAMminPoolSizeError", - "closeConnection": true + "errorCode": 91 } } } @@ -68,6 +68,7 @@ "heartbeatFrequencyMS": 10000, "appname": "SDAMminPoolSizeError", "minPoolSize": 10, + "serverMonitoringMode": "poll", "serverSelectionTimeoutMS": 1000 } } diff --git a/test/load_balancer/sdam-error-handling.json b/test/load_balancer/sdam-error-handling.json index 5892dcacd6..41bc90be7f 100644 --- a/test/load_balancer/sdam-error-handling.json +++ b/test/load_balancer/sdam-error-handling.json @@ -282,7 +282,7 @@ "isMaster", "hello" ], - "closeConnection": true, + "errorCode": 11600, "appName": "lbSDAMErrorTestClient" } } @@ -297,7 +297,7 @@ } }, "expectError": { - "isClientError": true + "isError": true } } ],