diff --git a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.json b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.json new file mode 100644 index 0000000000..ccaea8d135 --- /dev/null +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.json @@ -0,0 +1,142 @@ +{ + "description": "backpressure-network-error-fail-replicaset", + "schemaVersion": "1.17", + "runOnRequirements": [ + { + "minServerVersion": "4.4", + "serverless": "forbid", + "topologies": [ + "replicaset" + ] + } + ], + "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": [ + "serverDescriptionChangedEvent", + "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": { + "serverDescriptionChangedEvent": { + "newDescription": { + "type": "RSPrimary" + } + } + }, + "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/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.yml b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.yml new file mode 100644 index 0000000000..3aac5349be --- /dev/null +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.yml @@ -0,0 +1,80 @@ +description: backpressure-network-error-fail-replicaset +schemaVersion: "1.17" +runOnRequirements: + - minServerVersion: "4.4" + serverless: forbid + topologies: + - replicaset +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: + - serverDescriptionChangedEvent + - 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: + serverDescriptionChangedEvent: + newDescription: + type: RSPrimary + 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/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.json b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.json similarity index 91% rename from source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.json rename to source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.json index f41b76459c..c1ff67c732 100644 --- a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.json +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.json @@ -1,14 +1,12 @@ { - "description": "backpressure-network-error-fail", + "description": "backpressure-network-error-fail-single", "schemaVersion": "1.17", "runOnRequirements": [ { "minServerVersion": "4.4", "serverless": "forbid", "topologies": [ - "single", - "replicaset", - "sharded" + "single" ] } ], @@ -48,7 +46,7 @@ "id": "client", "useMultipleMongoses": false, "observeEvents": [ - "serverHeartbeatSucceededEvent", + "serverDescriptionChangedEvent", "poolClearedEvent" ], "uriOptions": { @@ -82,7 +80,11 @@ "arguments": { "client": "client", "event": { - "serverHeartbeatSucceededEvent": {} + "serverDescriptionChangedEvent": { + "newDescription": { + "type": "Standalone" + } + } }, "count": 1 } diff --git a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.yml b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.yml similarity index 90% rename from source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.yml rename to source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.yml index 54e3030211..f5eebf2766 100644 --- a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail.yml +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-single.yml @@ -1,12 +1,10 @@ -description: backpressure-network-error-fail +description: backpressure-network-error-fail-single schemaVersion: "1.17" runOnRequirements: - minServerVersion: "4.4" serverless: forbid topologies: - single - - replicaset - - sharded createEntities: - client: id: setupClient @@ -28,7 +26,7 @@ tests: id: client useMultipleMongoses: false observeEvents: - - serverHeartbeatSucceededEvent + - serverDescriptionChangedEvent - poolClearedEvent uriOptions: retryWrites: false @@ -48,7 +46,9 @@ tests: arguments: client: client event: - serverHeartbeatSucceededEvent: {} + serverDescriptionChangedEvent: + newDescription: + type: Standalone count: 1 - name: failPoint object: testRunner diff --git a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.json b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.json new file mode 100644 index 0000000000..35b088f422 --- /dev/null +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.json @@ -0,0 +1,145 @@ +{ + "description": "backpressure-network-timeout-error-replicaset", + "schemaVersion": "1.17", + "runOnRequirements": [ + { + "minServerVersion": "4.4", + "serverless": "forbid", + "topologies": [ + "replicaset" + ] + } + ], + "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": { + "newDescription": { + "type": "RSPrimary" + } + } + }, + "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/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.yml b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.yml new file mode 100644 index 0000000000..487872adc6 --- /dev/null +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.yml @@ -0,0 +1,83 @@ +description: backpressure-network-timeout-error-replicaset +schemaVersion: "1.17" +runOnRequirements: + - minServerVersion: "4.4" + serverless: forbid + topologies: + - replicaset +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: + newDescription: + type: RSPrimary + 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/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.json b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.json similarity index 93% rename from source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.json rename to source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.json index a97c7a329f..54b11d4d5b 100644 --- a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.json +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.json @@ -1,14 +1,12 @@ { - "description": "backpressure-network-timeout-error", + "description": "backpressure-network-timeout-error-single", "schemaVersion": "1.17", "runOnRequirements": [ { "minServerVersion": "4.4", "serverless": "forbid", "topologies": [ - "single", - "replicaset", - "sharded" + "single" ] } ], @@ -84,7 +82,11 @@ "arguments": { "client": "client", "event": { - "serverDescriptionChangedEvent": {} + "serverDescriptionChangedEvent": { + "newDescription": { + "type": "Standalone" + } + } }, "count": 1 } diff --git a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.yml b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.yml similarity index 93% rename from source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.yml rename to source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.yml index 6a61eba3ad..6d94173174 100644 --- a/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail.yml +++ b/source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-single.yml @@ -1,12 +1,10 @@ -description: backpressure-network-timeout-error +description: backpressure-network-timeout-error-single schemaVersion: "1.17" runOnRequirements: - minServerVersion: "4.4" serverless: forbid topologies: - single - - replicaset - - sharded createEntities: - client: id: setupClient @@ -50,7 +48,9 @@ tests: arguments: client: client event: - serverDescriptionChangedEvent: {} + serverDescriptionChangedEvent: + newDescription: + type: Standalone count: 1 - name: failPoint object: testRunner