From a599c1238501d39ae58929cf85f63e1f72f79a21 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Tue, 13 Jan 2026 10:03:12 -0800 Subject: [PATCH 1/3] DRIVERS-3367: Fix racy backpressure-network-* tests --- .../backpressure-network-error-fail.json | 51 ++++++++---------- .../backpressure-network-error-fail.yml | 35 ++++++------ .../backpressure-network-timeout-fail.json | 53 ++++++++----------- .../backpressure-network-timeout-fail.yml | 37 ++++++------- 4 files changed, 74 insertions(+), 102 deletions(-) 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.json index f41b76459c..87013bd339 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.json @@ -38,6 +38,27 @@ { "description": "apply backpressure on network connection errors during connection establishment", "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "setupClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "skip": 1 + }, + "data": { + "failCommands": [ + "isMaster", + "hello" + ], + "appName": "backpressureNetworkErrorFailTest", + "closeConnection": true + } + } + } + }, { "name": "createEntities", "object": "testRunner", @@ -76,36 +97,6 @@ ] } }, - { - "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", 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.yml index 54e3030211..3e8fde1505 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.yml @@ -20,6 +20,21 @@ initialData: tests: - description: apply backpressure on network connection errors during connection establishment operations: + - name: failPoint + object: testRunner + arguments: + client: setupClient + failPoint: + configureFailPoint: failCommand + mode: + # skip first hello to let heartbeat set server to connected state + skip: 1 + data: + failCommands: + - isMaster + - hello + appName: backpressureNetworkErrorFailTest + closeConnection: true - name: createEntities object: testRunner arguments: @@ -43,26 +58,6 @@ tests: 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: 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.json index a97c7a329f..42df98e5b5 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.json @@ -38,6 +38,28 @@ { "description": "apply backpressure on network timeout error during connection establishment", "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "setupClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "skip": 1 + }, + "data": { + "failCommands": [ + "isMaster", + "hello" + ], + "blockConnection": true, + "blockTimeMS": 500, + "appName": "backpressureNetworkTimeoutErrorTest" + } + } + } + }, { "name": "createEntities", "object": "testRunner", @@ -78,37 +100,6 @@ ] } }, - { - "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", 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.yml index 6a61eba3ad..3869888d00 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.yml @@ -20,6 +20,22 @@ initialData: tests: - description: apply backpressure on network timeout error during connection establishment operations: + - name: failPoint + object: testRunner + arguments: + client: setupClient + failPoint: + configureFailPoint: failCommand + mode: + # skip first hello to let heartbeat set server to connected state + skip: 1 + data: + failCommands: + - isMaster + - hello + blockConnection: true + blockTimeMS: 500 + appName: backpressureNetworkTimeoutErrorTest - name: createEntities object: testRunner arguments: @@ -45,27 +61,6 @@ tests: 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: From 6846236599c1345f201bbda238bdc0b0ce705c83 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Tue, 13 Jan 2026 11:04:43 -0800 Subject: [PATCH 2/3] Revert "DRIVERS-3367: Fix racy backpressure-network-* tests" This reverts commit a599c1238501d39ae58929cf85f63e1f72f79a21. --- .../backpressure-network-error-fail.json | 51 ++++++++++-------- .../backpressure-network-error-fail.yml | 35 ++++++------ .../backpressure-network-timeout-fail.json | 53 +++++++++++-------- .../backpressure-network-timeout-fail.yml | 37 +++++++------ 4 files changed, 102 insertions(+), 74 deletions(-) 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.json index 87013bd339..f41b76459c 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.json @@ -38,27 +38,6 @@ { "description": "apply backpressure on network connection errors during connection establishment", "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "setupClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "skip": 1 - }, - "data": { - "failCommands": [ - "isMaster", - "hello" - ], - "appName": "backpressureNetworkErrorFailTest", - "closeConnection": true - } - } - } - }, { "name": "createEntities", "object": "testRunner", @@ -97,6 +76,36 @@ ] } }, + { + "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", 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.yml index 3e8fde1505..54e3030211 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.yml @@ -20,21 +20,6 @@ initialData: tests: - description: apply backpressure on network connection errors during connection establishment operations: - - name: failPoint - object: testRunner - arguments: - client: setupClient - failPoint: - configureFailPoint: failCommand - mode: - # skip first hello to let heartbeat set server to connected state - skip: 1 - data: - failCommands: - - isMaster - - hello - appName: backpressureNetworkErrorFailTest - closeConnection: true - name: createEntities object: testRunner arguments: @@ -58,6 +43,26 @@ tests: 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: 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.json index 42df98e5b5..a97c7a329f 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.json @@ -38,28 +38,6 @@ { "description": "apply backpressure on network timeout error during connection establishment", "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "setupClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "skip": 1 - }, - "data": { - "failCommands": [ - "isMaster", - "hello" - ], - "blockConnection": true, - "blockTimeMS": 500, - "appName": "backpressureNetworkTimeoutErrorTest" - } - } - } - }, { "name": "createEntities", "object": "testRunner", @@ -100,6 +78,37 @@ ] } }, + { + "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", 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.yml index 3869888d00..6a61eba3ad 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.yml @@ -20,22 +20,6 @@ initialData: tests: - description: apply backpressure on network timeout error during connection establishment operations: - - name: failPoint - object: testRunner - arguments: - client: setupClient - failPoint: - configureFailPoint: failCommand - mode: - # skip first hello to let heartbeat set server to connected state - skip: 1 - data: - failCommands: - - isMaster - - hello - blockConnection: true - blockTimeMS: 500 - appName: backpressureNetworkTimeoutErrorTest - name: createEntities object: testRunner arguments: @@ -61,6 +45,27 @@ tests: 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: From 3e2bf06c721d1d6d591c769afc87ad015b705559 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Tue, 13 Jan 2026 17:30:58 -0800 Subject: [PATCH 3/3] pr --- ...ressure-network-error-fail-replicaset.json | 142 +++++++++++++++++ ...pressure-network-error-fail-replicaset.yml | 80 ++++++++++ ...ckpressure-network-error-fail-single.json} | 14 +- ...ackpressure-network-error-fail-single.yml} | 10 +- ...ssure-network-timeout-fail-replicaset.json | 145 ++++++++++++++++++ ...essure-network-timeout-fail-replicaset.yml | 83 ++++++++++ ...pressure-network-timeout-fail-single.json} | 12 +- ...kpressure-network-timeout-fail-single.yml} | 8 +- 8 files changed, 474 insertions(+), 20 deletions(-) create mode 100644 source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.json create mode 100644 source/server-discovery-and-monitoring/tests/unified/backpressure-network-error-fail-replicaset.yml rename source/server-discovery-and-monitoring/tests/unified/{backpressure-network-error-fail.json => backpressure-network-error-fail-single.json} (91%) rename source/server-discovery-and-monitoring/tests/unified/{backpressure-network-error-fail.yml => backpressure-network-error-fail-single.yml} (90%) create mode 100644 source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.json create mode 100644 source/server-discovery-and-monitoring/tests/unified/backpressure-network-timeout-fail-replicaset.yml rename source/server-discovery-and-monitoring/tests/unified/{backpressure-network-timeout-fail.json => backpressure-network-timeout-fail-single.json} (93%) rename source/server-discovery-and-monitoring/tests/unified/{backpressure-network-timeout-fail.yml => backpressure-network-timeout-fail-single.yml} (93%) 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