diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml
index 0ac0bf127af..9e0b973971a 100644
--- a/config/checkstyle/suppressions.xml
+++ b/config/checkstyle/suppressions.xml
@@ -34,6 +34,8 @@
+
+
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-error.json
deleted file mode 100644
index 064d660e321..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-error.json
+++ /dev/null
@@ -1,140 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "authEnabled": true
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "auth-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after AuthenticationFailure error",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "saslContinue"
- ],
- "appName": "authErrorTest",
- "errorCode": 18
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "authErrorTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "auth-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-misc-command-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-misc-command-error.json
deleted file mode 100644
index 70dd59251df..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-misc-command-error.json
+++ /dev/null
@@ -1,140 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "authEnabled": true
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "auth-misc-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after misc command error",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "saslContinue"
- ],
- "appName": "authMiscErrorTest",
- "errorCode": 1
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "authMiscErrorTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "auth-misc-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-error.json
deleted file mode 100644
index a75a398c5e1..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-error.json
+++ /dev/null
@@ -1,140 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "authEnabled": true
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "auth-network-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after network error during authentication",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "saslContinue"
- ],
- "closeConnection": true,
- "appName": "authNetworkErrorTest"
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "authNetworkErrorTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "auth-network-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-timeout-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-timeout-error.json
deleted file mode 100644
index a4ee7d9effd..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-network-timeout-error.json
+++ /dev/null
@@ -1,143 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "authEnabled": true
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "auth-network-timeout-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after network timeout error during authentication",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "saslContinue"
- ],
- "blockConnection": true,
- "blockTimeMS": 500,
- "appName": "authNetworkTimeoutErrorTest"
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "authNetworkTimeoutErrorTest",
- "connectTimeoutMS": 250,
- "socketTimeoutMS": 250
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "auth-network-timeout-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-shutdown-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-shutdown-error.json
deleted file mode 100644
index 2dab90e1c56..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/auth-shutdown-error.json
+++ /dev/null
@@ -1,140 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "authEnabled": true
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "auth-shutdown-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after shutdown error during authentication",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "saslContinue"
- ],
- "appName": "authShutdownErrorTest",
- "errorCode": 91
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "authShutdownErrorTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "auth-shutdown-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/cancel-server-check.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/cancel-server-check.json
deleted file mode 100644
index 95863509595..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/cancel-server-check.json
+++ /dev/null
@@ -1,130 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.0",
- "topology": [
- "replicaset"
- ]
- },
- {
- "minServerVersion": "4.2",
- "topology": [
- "sharded"
- ]
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "cancel-server-check",
- "data": [],
- "tests": [
- {
- "description": "Cancel server check",
- "clientOptions": {
- "retryWrites": true,
- "heartbeatFrequencyMS": 10000,
- "serverSelectionTimeoutMS": 5000,
- "appname": "cancelServerCheckTest"
- },
- "operations": [
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 1
- }
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "insert"
- ],
- "closeConnection": true
- }
- }
- }
- },
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 2
- }
- },
- "result": {
- "insertedId": 2
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 3
- }
- },
- "result": {
- "insertedId": 3
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/connectTimeoutMS.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/connectTimeoutMS.json
deleted file mode 100644
index 36a6dc4507e..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/connectTimeoutMS.json
+++ /dev/null
@@ -1,149 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "connectTimeoutMS",
- "data": [],
- "tests": [
- {
- "description": "connectTimeoutMS=0",
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 0,
- "heartbeatFrequencyMS": 500,
- "appname": "connectTimeoutMS=0"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "connectTimeoutMS=0",
- "blockConnection": true,
- "blockTimeMS": 550
- }
- }
- }
- },
- {
- "name": "wait",
- "object": "testRunner",
- "arguments": {
- "ms": 750
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 0
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 0
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "connectTimeoutMS",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "connectTimeoutMS",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-error.json
deleted file mode 100644
index 4db2634cd62..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-error.json
+++ /dev/null
@@ -1,144 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "find-network-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after network error on find",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "find"
- ],
- "closeConnection": true,
- "appName": "findNetworkErrorTest"
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "retryReads": false,
- "appname": "findNetworkErrorTest"
- },
- "operations": [
- {
- "name": "find",
- "object": "collection",
- "arguments": {
- "filter": {
- "_id": 1
- }
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "find": "find-network-error"
- },
- "command_name": "find",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "find-network-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-timeout-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-timeout-error.json
deleted file mode 100644
index c4e10b3a764..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-network-timeout-error.json
+++ /dev/null
@@ -1,119 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "find-network-timeout-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Ignore network timeout error on find",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "find"
- ],
- "blockConnection": true,
- "blockTimeMS": 500,
- "appName": "findNetworkTimeoutErrorTest"
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "retryReads": false,
- "appname": "findNetworkTimeoutErrorTest",
- "socketTimeoutMS": 250
- },
- "operations": [
- {
- "name": "find",
- "object": "collection",
- "arguments": {
- "filter": {
- "_id": 1
- }
- },
- "error": true
- },
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 3
- }
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 0
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 0
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "find": "find-network-timeout-error"
- },
- "command_name": "find",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "find-network-timeout-error",
- "documents": [
- {
- "_id": 3
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-shutdown-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-shutdown-error.json
deleted file mode 100644
index 65de8398b13..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/find-shutdown-error.json
+++ /dev/null
@@ -1,168 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "find-shutdown-error",
- "data": [],
- "tests": [
- {
- "description": "Concurrent shutdown error on find",
- "clientOptions": {
- "retryWrites": false,
- "retryReads": false,
- "heartbeatFrequencyMS": 500,
- "appname": "shutdownErrorFindTest"
- },
- "operations": [
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 1
- }
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "find"
- ],
- "appName": "shutdownErrorFindTest",
- "errorCode": 91,
- "blockConnection": true,
- "blockTimeMS": 500
- }
- }
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2"
- }
- },
- {
- "name": "runOnThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1",
- "operation": {
- "name": "find",
- "object": "collection",
- "arguments": {
- "filter": {
- "_id": 1
- }
- },
- "error": true
- }
- }
- },
- {
- "name": "runOnThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2",
- "operation": {
- "name": "find",
- "object": "collection",
- "arguments": {
- "filter": {
- "_id": 1
- }
- },
- "error": true
- }
- }
- },
- {
- "name": "waitForThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1"
- }
- },
- {
- "name": "waitForThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2"
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 4
- }
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-command-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-command-error.json
deleted file mode 100644
index d3bccd39008..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-command-error.json
+++ /dev/null
@@ -1,223 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.9"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "hello-command-error",
- "data": [],
- "tests": [
- {
- "description": "Command error on Monitor handshake",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "commandErrorHandshakeTest",
- "closeConnection": false,
- "errorCode": 91
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 250,
- "heartbeatFrequencyMS": 500,
- "appname": "commandErrorHandshakeTest"
- },
- "operations": [
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-command-error",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- },
- {
- "description": "Command error on Monitor check",
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 1000,
- "heartbeatFrequencyMS": 500,
- "appname": "commandErrorCheckTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 4
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "commandErrorCheckTest",
- "closeConnection": false,
- "blockConnection": true,
- "blockTimeMS": 750,
- "errorCode": 91
- }
- }
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-command-error",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "hello-command-error",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-network-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-network-error.json
deleted file mode 100644
index f9761d75563..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-network-error.json
+++ /dev/null
@@ -1,219 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.9"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "hello-network-error",
- "data": [],
- "tests": [
- {
- "description": "Network error on Monitor handshake",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "networkErrorHandshakeTest",
- "closeConnection": true
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 250,
- "heartbeatFrequencyMS": 500,
- "appname": "networkErrorHandshakeTest"
- },
- "operations": [
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-network-error",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- },
- {
- "description": "Network error on Monitor check",
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 250,
- "heartbeatFrequencyMS": 500,
- "appname": "networkErrorCheckTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 4
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "networkErrorCheckTest",
- "closeConnection": true
- }
- }
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-network-error",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "hello-network-error",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-timeout.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-timeout.json
deleted file mode 100644
index 004f8f449d5..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/hello-timeout.json
+++ /dev/null
@@ -1,337 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "hello-timeout",
- "data": [],
- "tests": [
- {
- "description": "Network timeout on Monitor handshake",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "timeoutMonitorHandshakeTest",
- "blockConnection": true,
- "blockTimeMS": 1000
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 250,
- "heartbeatFrequencyMS": 500,
- "appname": "timeoutMonitorHandshakeTest"
- },
- "operations": [
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-timeout",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- }
- },
- {
- "description": "Network timeout on Monitor check",
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 750,
- "heartbeatFrequencyMS": 500,
- "appname": "timeoutMonitorCheckTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 4
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "timeoutMonitorCheckTest",
- "blockConnection": true,
- "blockTimeMS": 1000
- }
- }
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-timeout",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "hello-timeout",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- },
- {
- "description": "Driver extends timeout while streaming",
- "clientOptions": {
- "retryWrites": false,
- "connectTimeoutMS": 250,
- "heartbeatFrequencyMS": 500,
- "appname": "extendsTimeoutTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- }
- },
- {
- "name": "wait",
- "object": "testRunner",
- "arguments": {
- "ms": 2000
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 0
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 0
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "hello-timeout",
- "documents": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "hello-timeout",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-network-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-network-error.json
deleted file mode 100644
index fa8bb253e12..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-network-error.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "insert-network-error",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Reset server and pool after network error on insert",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 1
- },
- "data": {
- "failCommands": [
- "insert"
- ],
- "closeConnection": true,
- "appName": "insertNetworkErrorTest"
- }
- },
- "clientOptions": {
- "retryWrites": false,
- "appname": "insertNetworkErrorTest"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "error": true
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "insert-network-error",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "insert-network-error",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-shutdown-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-shutdown-error.json
deleted file mode 100644
index edde149a91b..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/insert-shutdown-error.json
+++ /dev/null
@@ -1,167 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "insert-shutdown-error",
- "data": [],
- "tests": [
- {
- "description": "Concurrent shutdown error on insert",
- "clientOptions": {
- "retryWrites": false,
- "heartbeatFrequencyMS": 500,
- "appname": "shutdownErrorInsertTest"
- },
- "operations": [
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 1
- }
- }
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "times": 2
- },
- "data": {
- "failCommands": [
- "insert"
- ],
- "appName": "shutdownErrorInsertTest",
- "errorCode": 91,
- "blockConnection": true,
- "blockTimeMS": 500
- }
- }
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2"
- }
- },
- {
- "name": "runOnThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1",
- "operation": {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 2
- }
- },
- "error": true
- }
- }
- },
- {
- "name": "runOnThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2",
- "operation": {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 3
- }
- },
- "error": true
- }
- }
- },
- {
- "name": "waitForThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1"
- }
- },
- {
- "name": "waitForThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2"
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "insertOne",
- "object": "collection",
- "arguments": {
- "document": {
- "_id": 4
- }
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 4
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/minPoolSize-error.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/minPoolSize-error.json
deleted file mode 100644
index 9f8e4f6f8be..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/minPoolSize-error.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.9"
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "sdam-minPoolSize-error",
- "data": [],
- "tests": [
- {
- "description": "Network error on minPoolSize background creation",
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": {
- "skip": 3
- },
- "data": {
- "failCommands": [
- "hello",
- "isMaster"
- ],
- "appName": "SDAMminPoolSizeError",
- "closeConnection": true
- }
- },
- "clientOptions": {
- "heartbeatFrequencyMS": 10000,
- "appname": "SDAMminPoolSizeError",
- "minPoolSize": 10,
- "serverSelectionTimeoutMS": 1000,
- "directConnection": true
- },
- "operations": [
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolReadyEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 1
- }
- },
- {
- "name": "waitForEvent",
- "object": "testRunner",
- "arguments": {
- "event": "ServerMarkedUnknownEvent",
- "count": 1
- }
- },
- {
- "name": "runCommand",
- "object": "database",
- "command_name": "ping",
- "arguments": {
- "command": {
- "ping": {}
- }
- },
- "error": true
- },
- {
- "name": "configureFailPoint",
- "object": "testRunner",
- "arguments": {
- "failPoint": {
- "configureFailPoint": "failCommand",
- "mode": "off"
- }
- }
- },
- {
- "name": "runCommand",
- "object": "database",
- "command_name": "ping",
- "arguments": {
- "command": {
- "ping": 1
- }
- },
- "error": false
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolReadyEvent",
- "count": 2
- }
- }
- ]
- }
- ]
-}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/rediscover-quickly-after-step-down.json b/driver-core/src/test/resources/server-discovery-and-monitoring-integration/rediscover-quickly-after-step-down.json
deleted file mode 100644
index 41fbdc695cf..00000000000
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/rediscover-quickly-after-step-down.json
+++ /dev/null
@@ -1,165 +0,0 @@
-{
- "runOn": [
- {
- "minServerVersion": "4.4",
- "topology": [
- "replicaset"
- ]
- }
- ],
- "database_name": "sdam-tests",
- "collection_name": "test-replSetStepDown",
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- }
- ],
- "tests": [
- {
- "description": "Rediscover quickly after replSetStepDown",
- "clientOptions": {
- "appname": "replSetStepDownTest",
- "heartbeatFrequencyMS": 60000,
- "serverSelectionTimeoutMS": 5000,
- "w": "majority"
- },
- "operations": [
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- }
- },
- {
- "name": "recordPrimary",
- "object": "testRunner"
- },
- {
- "name": "runAdminCommand",
- "object": "testRunner",
- "command_name": "replSetFreeze",
- "arguments": {
- "command": {
- "replSetFreeze": 0
- },
- "readPreference": {
- "mode": "Secondary"
- }
- }
- },
- {
- "name": "runAdminCommand",
- "object": "testRunner",
- "command_name": "replSetStepDown",
- "arguments": {
- "command": {
- "replSetStepDown": 30,
- "secondaryCatchUpPeriodSecs": 30,
- "force": false
- }
- }
- },
- {
- "name": "waitForPrimaryChange",
- "object": "testRunner",
- "arguments": {
- "timeoutMS": 15000
- }
- },
- {
- "name": "insertMany",
- "object": "collection",
- "arguments": {
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- },
- {
- "name": "assertEventCount",
- "object": "testRunner",
- "arguments": {
- "event": "PoolClearedEvent",
- "count": 0
- }
- }
- ],
- "expectations": [
- {
- "command_started_event": {
- "command": {
- "insert": "test-replSetStepDown",
- "documents": [
- {
- "_id": 3
- },
- {
- "_id": 4
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- },
- {
- "command_started_event": {
- "command": {
- "insert": "test-replSetStepDown",
- "documents": [
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- },
- "command_name": "insert",
- "database_name": "sdam-tests"
- }
- }
- ],
- "outcome": {
- "collection": {
- "data": [
- {
- "_id": 1
- },
- {
- "_id": 2
- },
- {
- "_id": 3
- },
- {
- "_id": 4
- },
- {
- "_id": 5
- },
- {
- "_id": 6
- }
- ]
- }
- }
- }
- ]
-}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-error.json
new file mode 100644
index 00000000000..5c78ecfe503
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-error.json
@@ -0,0 +1,230 @@
+{
+ "description": "auth-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "auth": true,
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "auth-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after AuthenticationFailure error",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "saslContinue"
+ ],
+ "appName": "authErrorTest",
+ "errorCode": 18
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "authErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "auth-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "auth-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "auth-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-misc-command-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-misc-command-error.json
new file mode 100644
index 00000000000..6e1b645461e
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-misc-command-error.json
@@ -0,0 +1,230 @@
+{
+ "description": "auth-misc-command-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "auth": true,
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "auth-misc-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after misc command error",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "saslContinue"
+ ],
+ "appName": "authMiscErrorTest",
+ "errorCode": 1
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "authMiscErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "auth-misc-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "auth-misc-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "auth-misc-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-error.json
new file mode 100644
index 00000000000..7606d2db7ab
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-error.json
@@ -0,0 +1,230 @@
+{
+ "description": "auth-network-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "auth": true,
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "auth-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after network error during authentication",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "saslContinue"
+ ],
+ "closeConnection": true,
+ "appName": "authNetworkErrorTest"
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "authNetworkErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "auth-network-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "auth-network-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "auth-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-timeout-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-timeout-error.json
new file mode 100644
index 00000000000..22066e8baeb
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-network-timeout-error.json
@@ -0,0 +1,233 @@
+{
+ "description": "auth-network-timeout-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "auth": true,
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "auth-network-timeout-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after network timeout error during authentication",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "saslContinue"
+ ],
+ "blockConnection": true,
+ "blockTimeMS": 500,
+ "appName": "authNetworkTimeoutErrorTest"
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "authNetworkTimeoutErrorTest",
+ "connectTimeoutMS": 250,
+ "socketTimeoutMS": 250
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "auth-network-timeout-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "auth-network-timeout-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "auth-network-timeout-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-shutdown-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-shutdown-error.json
new file mode 100644
index 00000000000..5dd7b5bb6fe
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/auth-shutdown-error.json
@@ -0,0 +1,230 @@
+{
+ "description": "auth-shutdown-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "auth": true,
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "auth-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after shutdown error during authentication",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "saslContinue"
+ ],
+ "appName": "authShutdownErrorTest",
+ "errorCode": 91
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "authShutdownErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "auth-shutdown-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "auth-shutdown-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "auth-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/cancel-server-check.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/cancel-server-check.json
new file mode 100644
index 00000000000..896cc8d0871
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/cancel-server-check.json
@@ -0,0 +1,201 @@
+{
+ "description": "cancel-server-check",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.0",
+ "topologies": [
+ "replicaset"
+ ],
+ "serverless": "forbid"
+ },
+ {
+ "minServerVersion": "4.2",
+ "topologies": [
+ "sharded"
+ ],
+ "serverless": "forbid"
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "cancel-server-check",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Cancel server check",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": true,
+ "heartbeatFrequencyMS": 10000,
+ "serverSelectionTimeoutMS": 5000,
+ "appname": "cancelServerCheckTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "cancel-server-check"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 1
+ }
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "insert"
+ ],
+ "closeConnection": true
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 2
+ }
+ },
+ "expectResult": {
+ "insertedId": 2
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 3
+ }
+ },
+ "expectResult": {
+ "insertedId": 3
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "cancel-server-check",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/connectTimeoutMS.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/connectTimeoutMS.json
new file mode 100644
index 00000000000..67a4d9da1d3
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/connectTimeoutMS.json
@@ -0,0 +1,221 @@
+{
+ "description": "connectTimeoutMS",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "connectTimeoutMS",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "connectTimeoutMS=0",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 0,
+ "heartbeatFrequencyMS": 500,
+ "appname": "connectTimeoutMS=0"
+ },
+ "useMultipleMongoses": false
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "connectTimeoutMS"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "connectTimeoutMS=0",
+ "blockConnection": true,
+ "blockTimeMS": 550
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "wait",
+ "object": "testRunner",
+ "arguments": {
+ "ms": 750
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 0
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 0
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "connectTimeoutMS",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "connectTimeoutMS",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "connectTimeoutMS",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-error.json
new file mode 100644
index 00000000000..651466bfa6d
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-error.json
@@ -0,0 +1,234 @@
+{
+ "description": "find-network-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "find-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after network error on find",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "find"
+ ],
+ "closeConnection": true,
+ "appName": "findNetworkErrorTest"
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "retryReads": false,
+ "appname": "findNetworkErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "find-network-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "find",
+ "object": "collection",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "find-network-error"
+ },
+ "commandName": "find",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "find-network-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "find-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-timeout-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-timeout-error.json
new file mode 100644
index 00000000000..2bde6daa5df
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-network-timeout-error.json
@@ -0,0 +1,199 @@
+{
+ "description": "find-network-timeout-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "find-network-timeout-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Ignore network timeout error on find",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "find"
+ ],
+ "blockConnection": true,
+ "blockTimeMS": 500,
+ "appName": "findNetworkTimeoutErrorTest"
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "retryReads": false,
+ "appname": "findNetworkTimeoutErrorTest",
+ "socketTimeoutMS": 250
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "find-network-timeout-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "find",
+ "object": "collection",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 3
+ }
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 0
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 0
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "find": "find-network-timeout-error"
+ },
+ "commandName": "find",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "find-network-timeout-error",
+ "documents": [
+ {
+ "_id": 3
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "find-network-timeout-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-shutdown-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-shutdown-error.json
new file mode 100644
index 00000000000..624ad352fc9
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/find-shutdown-error.json
@@ -0,0 +1,251 @@
+{
+ "description": "find-shutdown-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "find-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Concurrent shutdown error on find",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "uriOptions": {
+ "retryWrites": false,
+ "retryReads": false,
+ "heartbeatFrequencyMS": 500,
+ "appname": "shutdownErrorFindTest"
+ },
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ]
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "find-shutdown-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 1
+ }
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "find"
+ ],
+ "appName": "shutdownErrorFindTest",
+ "errorCode": 91,
+ "blockConnection": true,
+ "blockTimeMS": 500
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "thread": {
+ "id": "thread0"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread1"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "runOnThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread0",
+ "operation": {
+ "name": "find",
+ "object": "collection",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ }
+ }
+ },
+ {
+ "name": "runOnThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread1",
+ "operation": {
+ "name": "find",
+ "object": "collection",
+ "arguments": {
+ "filter": {
+ "_id": 1
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ }
+ }
+ },
+ {
+ "name": "waitForThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread0"
+ }
+ },
+ {
+ "name": "waitForThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread1"
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 4
+ }
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "find-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-command-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-command-error.json
new file mode 100644
index 00000000000..7d6046b76f5
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-command-error.json
@@ -0,0 +1,376 @@
+{
+ "description": "hello-command-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.9",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "hello-command-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Command error on Monitor handshake",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 4
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "commandErrorHandshakeTest",
+ "closeConnection": false,
+ "errorCode": 91
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent",
+ "commandStartedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 250,
+ "heartbeatFrequencyMS": 500,
+ "appname": "commandErrorHandshakeTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-command-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-command-error",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-command-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Command error on Monitor check",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 1000,
+ "heartbeatFrequencyMS": 500,
+ "appname": "commandErrorCheckTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-command-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "commandErrorCheckTest",
+ "closeConnection": false,
+ "blockConnection": true,
+ "blockTimeMS": 750,
+ "errorCode": 91
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-command-error",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-command-error",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-command-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-network-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-network-error.json
new file mode 100644
index 00000000000..f44b26a9f91
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-network-error.json
@@ -0,0 +1,346 @@
+{
+ "description": "hello-network-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.9",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "hello-network-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Network error on Monitor handshake",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "networkErrorHandshakeTest",
+ "closeConnection": true
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 250,
+ "heartbeatFrequencyMS": 500,
+ "appname": "networkErrorHandshakeTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-network-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-network-error",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Network error on Monitor check",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 250,
+ "heartbeatFrequencyMS": 500,
+ "appname": "networkErrorCheckTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-network-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 4
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "networkErrorCheckTest",
+ "closeConnection": true
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-network-error",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-network-error",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-timeout.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-timeout.json
new file mode 100644
index 00000000000..dfa6b48d66b
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/hello-timeout.json
@@ -0,0 +1,514 @@
+{
+ "description": "hello-timeout",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "hello-timeout",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Network timeout on Monitor handshake",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "timeoutMonitorHandshakeTest",
+ "blockConnection": true,
+ "blockTimeMS": 1000
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 250,
+ "heartbeatFrequencyMS": 500,
+ "appname": "timeoutMonitorHandshakeTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-timeout"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-timeout",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-timeout",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Network timeout on Monitor check",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 750,
+ "heartbeatFrequencyMS": 500,
+ "appname": "timeoutMonitorCheckTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-timeout"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 4
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "timeoutMonitorCheckTest",
+ "blockConnection": true,
+ "blockTimeMS": 1000
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-timeout",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-timeout",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-timeout",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "description": "Driver extends timeout while streaming",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "connectTimeoutMS": 250,
+ "heartbeatFrequencyMS": 500,
+ "appname": "extendsTimeoutTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "hello-timeout"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ },
+ {
+ "name": "wait",
+ "object": "testRunner",
+ "arguments": {
+ "ms": 2000
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 0
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 0
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-timeout",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "hello-timeout",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "hello-timeout",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-network-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-network-error.json
new file mode 100644
index 00000000000..e4ba6684ae2
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-network-error.json
@@ -0,0 +1,246 @@
+{
+ "description": "insert-network-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "insert-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Reset server and pool after network error on insert",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 1
+ },
+ "data": {
+ "failCommands": [
+ "insert"
+ ],
+ "closeConnection": true,
+ "appName": "insertNetworkErrorTest"
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "observeEvents": [
+ "commandStartedEvent",
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": false,
+ "appname": "insertNetworkErrorTest"
+ },
+ "useMultipleMongoses": false
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "insert-network-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "insert-network-error",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "insert-network-error",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "insert-network-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-shutdown-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-shutdown-error.json
new file mode 100644
index 00000000000..3c724fa5e4c
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/insert-shutdown-error.json
@@ -0,0 +1,250 @@
+{
+ "description": "insert-shutdown-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "single",
+ "replicaset",
+ "sharded"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "insert-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Concurrent shutdown error on insert",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "uriOptions": {
+ "retryWrites": false,
+ "heartbeatFrequencyMS": 500,
+ "appname": "shutdownErrorInsertTest"
+ },
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ]
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "insert-shutdown-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 1
+ }
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "times": 2
+ },
+ "data": {
+ "failCommands": [
+ "insert"
+ ],
+ "appName": "shutdownErrorInsertTest",
+ "errorCode": 91,
+ "blockConnection": true,
+ "blockTimeMS": 500
+ }
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "thread": {
+ "id": "thread0"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread1"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "runOnThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread0",
+ "operation": {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 2
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ }
+ }
+ },
+ {
+ "name": "runOnThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread1",
+ "operation": {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 3
+ }
+ },
+ "expectError": {
+ "isError": true
+ }
+ }
+ }
+ },
+ {
+ "name": "waitForThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread0"
+ }
+ },
+ {
+ "name": "waitForThread",
+ "object": "testRunner",
+ "arguments": {
+ "thread": "thread1"
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "insertOne",
+ "object": "collection",
+ "arguments": {
+ "document": {
+ "_id": 4
+ }
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "insert-shutdown-error",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/minPoolSize-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/minPoolSize-error.json
new file mode 100644
index 00000000000..0234ac99292
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/minPoolSize-error.json
@@ -0,0 +1,177 @@
+{
+ "description": "minPoolSize-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.9",
+ "serverless": "forbid",
+ "topologies": [
+ "single"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "sdam-minPoolSize-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
+ "tests": [
+ {
+ "description": "Network error on minPoolSize background creation",
+ "operations": [
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "client": "setupClient",
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": {
+ "skip": 3
+ },
+ "data": {
+ "failCommands": [
+ "hello",
+ "isMaster"
+ ],
+ "appName": "SDAMminPoolSizeError",
+ "closeConnection": true
+ }
+ }
+ }
+ },
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent",
+ "poolReadyEvent"
+ ],
+ "uriOptions": {
+ "heartbeatFrequencyMS": 10000,
+ "appname": "SDAMminPoolSizeError",
+ "minPoolSize": 10,
+ "serverSelectionTimeoutMS": 1000
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "sdam-minPoolSize-error"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolReadyEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "waitForEvent",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
+ "count": 1
+ }
+ },
+ {
+ "name": "runCommand",
+ "object": "database",
+ "arguments": {
+ "command": {
+ "ping": {}
+ },
+ "commandName": "ping"
+ },
+ "expectError": {
+ "isError": true
+ }
+ },
+ {
+ "name": "failPoint",
+ "object": "testRunner",
+ "arguments": {
+ "failPoint": {
+ "configureFailPoint": "failCommand",
+ "mode": "off"
+ },
+ "client": "setupClient"
+ }
+ },
+ {
+ "name": "runCommand",
+ "object": "database",
+ "arguments": {
+ "command": {
+ "ping": 1
+ },
+ "commandName": "ping"
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolReadyEvent": {}
+ },
+ "count": 2
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/pool-cleared-error.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/pool-cleared-error.json
similarity index 60%
rename from driver-core/src/test/resources/server-discovery-and-monitoring-integration/pool-cleared-error.json
rename to driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/pool-cleared-error.json
index 52456f9e133..9a7dfd901c5 100644
--- a/driver-core/src/test/resources/server-discovery-and-monitoring-integration/pool-cleared-error.json
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/pool-cleared-error.json
@@ -1,25 +1,72 @@
{
- "runOn": [
+ "description": "pool-cleared-error",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
{
"minServerVersion": "4.9",
- "topology": [
+ "serverless": "forbid",
+ "topologies": [
"replicaset",
"sharded"
]
}
],
- "database_name": "sdam-tests",
- "collection_name": "pool-cleared-error",
- "data": [],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient",
+ "useMultipleMongoses": false
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "pool-cleared-error",
+ "databaseName": "sdam-tests",
+ "documents": []
+ }
+ ],
"tests": [
{
"description": "PoolClearedError does not mark server unknown",
- "clientOptions": {
- "retryWrites": true,
- "maxPoolSize": 1,
- "appname": "poolClearedErrorTest"
- },
"operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "useMultipleMongoses": false,
+ "observeEvents": [
+ "serverDescriptionChangedEvent",
+ "poolClearedEvent"
+ ],
+ "uriOptions": {
+ "retryWrites": true,
+ "maxPoolSize": 1,
+ "appname": "poolClearedErrorTest"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "pool-cleared-error"
+ }
+ }
+ ]
+ }
+ },
{
"name": "insertOne",
"object": "collection",
@@ -30,7 +77,7 @@
}
},
{
- "name": "configureFailPoint",
+ "name": "failPoint",
"object": "testRunner",
"arguments": {
"failPoint": {
@@ -47,56 +94,53 @@
"closeConnection": true,
"appName": "poolClearedErrorTest"
}
- }
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread1"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread2"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread3"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread4"
- }
- },
- {
- "name": "startThread",
- "object": "testRunner",
- "arguments": {
- "name": "thread5"
+ },
+ "client": "setupClient"
}
},
{
- "name": "startThread",
+ "name": "createEntities",
"object": "testRunner",
"arguments": {
- "name": "thread6"
+ "entities": [
+ {
+ "thread": {
+ "id": "thread0"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread1"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread2"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread3"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread4"
+ }
+ },
+ {
+ "thread": {
+ "id": "thread5"
+ }
+ }
+ ]
}
},
{
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread1",
+ "thread": "thread0",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -112,7 +156,7 @@
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread2",
+ "thread": "thread1",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -128,7 +172,7 @@
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread3",
+ "thread": "thread2",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -144,7 +188,7 @@
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread4",
+ "thread": "thread3",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -160,7 +204,7 @@
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread5",
+ "thread": "thread4",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -176,7 +220,7 @@
"name": "runOnThread",
"object": "testRunner",
"arguments": {
- "name": "thread6",
+ "thread": "thread5",
"operation": {
"name": "insertOne",
"object": "collection",
@@ -192,49 +236,56 @@
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread1"
+ "thread": "thread0"
}
},
{
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread2"
+ "thread": "thread1"
}
},
{
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread3"
+ "thread": "thread2"
}
},
{
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread4"
+ "thread": "thread3"
}
},
{
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread5"
+ "thread": "thread4"
}
},
{
"name": "waitForThread",
"object": "testRunner",
"arguments": {
- "name": "thread6"
+ "thread": "thread5"
}
},
{
"name": "waitForEvent",
"object": "testRunner",
"arguments": {
- "event": "ServerMarkedUnknownEvent",
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
"count": 1
}
},
@@ -242,7 +293,10 @@
"name": "waitForEvent",
"object": "testRunner",
"arguments": {
- "event": "PoolClearedEvent",
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
"count": 1
}
},
@@ -259,7 +313,14 @@
"name": "assertEventCount",
"object": "testRunner",
"arguments": {
- "event": "ServerMarkedUnknownEvent",
+ "client": "client",
+ "event": {
+ "serverDescriptionChangedEvent": {
+ "newDescription": {
+ "type": "Unknown"
+ }
+ }
+ },
"count": 1
}
},
@@ -267,14 +328,19 @@
"name": "assertEventCount",
"object": "testRunner",
"arguments": {
- "event": "PoolClearedEvent",
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
"count": 1
}
}
],
- "outcome": {
- "collection": {
- "data": [
+ "outcome": [
+ {
+ "collectionName": "pool-cleared-error",
+ "databaseName": "sdam-tests",
+ "documents": [
{
"_id": 1
},
@@ -301,7 +367,7 @@
}
]
}
- }
+ ]
}
]
}
diff --git a/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/rediscover-quickly-after-step-down.json b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/rediscover-quickly-after-step-down.json
new file mode 100644
index 00000000000..0ad575cc9d0
--- /dev/null
+++ b/driver-core/src/test/resources/unified-test-format/server-discovery-and-monitoring/rediscover-quickly-after-step-down.json
@@ -0,0 +1,242 @@
+{
+ "description": "rediscover-quickly-after-step-down",
+ "schemaVersion": "1.10",
+ "runOnRequirements": [
+ {
+ "minServerVersion": "4.4",
+ "serverless": "forbid",
+ "topologies": [
+ "replicaset"
+ ]
+ }
+ ],
+ "createEntities": [
+ {
+ "client": {
+ "id": "setupClient"
+ }
+ },
+ {
+ "database": {
+ "id": "adminDatabase",
+ "client": "setupClient",
+ "databaseName": "admin"
+ }
+ }
+ ],
+ "initialData": [
+ {
+ "collectionName": "test-replSetStepDown",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ }
+ ]
+ }
+ ],
+ "tests": [
+ {
+ "description": "Rediscover quickly after replSetStepDown",
+ "operations": [
+ {
+ "name": "createEntities",
+ "object": "testRunner",
+ "arguments": {
+ "entities": [
+ {
+ "client": {
+ "id": "client",
+ "observeEvents": [
+ "poolClearedEvent",
+ "commandStartedEvent"
+ ],
+ "uriOptions": {
+ "appname": "replSetStepDownTest",
+ "heartbeatFrequencyMS": 60000,
+ "serverSelectionTimeoutMS": 5000,
+ "w": "majority"
+ }
+ }
+ },
+ {
+ "database": {
+ "id": "database",
+ "client": "client",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "collection": {
+ "id": "collection",
+ "database": "database",
+ "collectionName": "test-replSetStepDown"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ }
+ },
+ {
+ "name": "recordTopologyDescription",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "id": "topologyDescription"
+ }
+ },
+ {
+ "name": "assertTopologyType",
+ "object": "testRunner",
+ "arguments": {
+ "topologyDescription": "topologyDescription",
+ "topologyType": "ReplicaSetWithPrimary"
+ }
+ },
+ {
+ "name": "runCommand",
+ "object": "adminDatabase",
+ "arguments": {
+ "command": {
+ "replSetFreeze": 0
+ },
+ "readPreference": {
+ "mode": "Secondary"
+ },
+ "commandName": "replSetFreeze"
+ }
+ },
+ {
+ "name": "runCommand",
+ "object": "adminDatabase",
+ "arguments": {
+ "command": {
+ "replSetStepDown": 30,
+ "secondaryCatchUpPeriodSecs": 30,
+ "force": false
+ },
+ "commandName": "replSetStepDown"
+ }
+ },
+ {
+ "name": "waitForPrimaryChange",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "priorTopologyDescription": "topologyDescription",
+ "timeoutMS": 15000
+ }
+ },
+ {
+ "name": "insertMany",
+ "object": "collection",
+ "arguments": {
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ },
+ {
+ "name": "assertEventCount",
+ "object": "testRunner",
+ "arguments": {
+ "client": "client",
+ "event": {
+ "poolClearedEvent": {}
+ },
+ "count": 0
+ }
+ }
+ ],
+ "expectEvents": [
+ {
+ "client": "client",
+ "eventType": "command",
+ "events": [
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "test-replSetStepDown",
+ "documents": [
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ },
+ {
+ "commandStartedEvent": {
+ "command": {
+ "insert": "test-replSetStepDown",
+ "documents": [
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ },
+ "commandName": "insert",
+ "databaseName": "sdam-tests"
+ }
+ }
+ ]
+ }
+ ],
+ "outcome": [
+ {
+ "collectionName": "test-replSetStepDown",
+ "databaseName": "sdam-tests",
+ "documents": [
+ {
+ "_id": 1
+ },
+ {
+ "_id": 2
+ },
+ {
+ "_id": 3
+ },
+ {
+ "_id": 4
+ },
+ {
+ "_id": 5
+ },
+ {
+ "_id": 6
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/driver-core/src/test/unit/com/mongodb/internal/connection/TestServerListener.java b/driver-core/src/test/unit/com/mongodb/internal/connection/TestServerListener.java
index 9d3acb7774b..791b0b936d2 100644
--- a/driver-core/src/test/unit/com/mongodb/internal/connection/TestServerListener.java
+++ b/driver-core/src/test/unit/com/mongodb/internal/connection/TestServerListener.java
@@ -23,31 +23,47 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.function.Predicate;
-import static com.mongodb.assertions.Assertions.isTrue;
import static com.mongodb.assertions.Assertions.notNull;
-class TestServerListener implements ServerListener {
+public class TestServerListener implements ServerListener {
private ServerOpeningEvent serverOpeningEvent;
private ServerClosedEvent serverClosedEvent;
private final List serverDescriptionChangedEvents = new ArrayList();
+ private final Lock lock = new ReentrantLock();
+ private final Condition condition = lock.newCondition();
+ private volatile int waitingForEventCount;
+ private Predicate waitingForEventMatcher;
@Override
public void serverOpening(final ServerOpeningEvent event) {
- isTrue("serverOpeningEvent is null", serverOpeningEvent == null);
serverOpeningEvent = event;
}
@Override
public void serverClosed(final ServerClosedEvent event) {
- isTrue("serverClostedEvent is null", serverClosedEvent == null);
serverClosedEvent = event;
}
@Override
public void serverDescriptionChanged(final ServerDescriptionChangedEvent event) {
notNull("event", event);
- serverDescriptionChangedEvents.add(event);
+ lock.lock();
+ try {
+ serverDescriptionChangedEvents.add(event);
+ if (waitingForEventCount != 0 && containsEvents()) {
+ condition.signalAll();
+ }
+
+ } finally {
+ lock.unlock();
+ }
}
public ServerOpeningEvent getServerOpeningEvent() {
@@ -61,4 +77,38 @@ public ServerClosedEvent getServerClosedEvent() {
public List getServerDescriptionChangedEvents() {
return serverDescriptionChangedEvents;
}
+
+ public void waitForServerDescriptionChangedEvent(final Predicate matcher, final int count,
+ final int time, final TimeUnit unit) throws InterruptedException, TimeoutException {
+ if (count <= 0) {
+ throw new IllegalArgumentException();
+ }
+ lock.lock();
+ try {
+ if (waitingForEventCount != 0) {
+ throw new IllegalStateException("Already waiting for events");
+ }
+ waitingForEventCount = count;
+ waitingForEventMatcher = matcher;
+ if (containsEvents()) {
+ return;
+ }
+ if (!condition.await(time, unit)) {
+ throw new TimeoutException("Timed out waiting for " + count + " ServerDescriptionChangedEvent events. "
+ + "The count after timing out is " + countEvents());
+ }
+ } finally {
+ waitingForEventCount = 0;
+ waitingForEventMatcher = null;
+ lock.unlock();
+ }
+ }
+
+ private long countEvents() {
+ return serverDescriptionChangedEvents.stream().filter(waitingForEventMatcher).count();
+ }
+
+ private boolean containsEvents() {
+ return countEvents() >= waitingForEventCount;
+ }
}
diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ServerDiscoveryAndMonitoringTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ServerDiscoveryAndMonitoringTest.java
deleted file mode 100644
index 7df92c9d0e8..00000000000
--- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ServerDiscoveryAndMonitoringTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-present MongoDB, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.mongodb.reactivestreams.client;
-
-import com.mongodb.MongoClientSettings;
-import com.mongodb.client.AbstractServerDiscoveryAndMonitoringTest;
-import com.mongodb.client.MongoClient;
-import com.mongodb.connection.StreamFactoryFactory;
-import com.mongodb.reactivestreams.client.syncadapter.SyncMongoClient;
-import org.bson.BsonArray;
-import org.bson.BsonDocument;
-
-import static com.mongodb.ClusterFixture.getOverriddenStreamFactoryFactory;
-
-public class ServerDiscoveryAndMonitoringTest extends AbstractServerDiscoveryAndMonitoringTest {
- public ServerDiscoveryAndMonitoringTest(final String filename, final String description, final String databaseName,
- final String collectionName, final BsonArray data, final BsonDocument definition,
- final boolean skipTest) {
- super(filename, description, databaseName, collectionName, data, definition, skipTest);
- }
-
- @Override
- protected MongoClient createMongoClient(final MongoClientSettings settings) {
- return new SyncMongoClient(MongoClients.create(settings));
- }
-
- @Override
- protected StreamFactoryFactory getStreamFactoryFactory() {
- return getOverriddenStreamFactoryFactory();
- }
-}
diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedServerDiscoveryAndMonitoringTest.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedServerDiscoveryAndMonitoringTest.java
new file mode 100644
index 00000000000..4ea7b43bb02
--- /dev/null
+++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/unified/UnifiedServerDiscoveryAndMonitoringTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008-present MongoDB, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mongodb.reactivestreams.client.unified;
+
+import com.mongodb.lang.Nullable;
+import org.bson.BsonArray;
+import org.bson.BsonDocument;
+import org.junit.runners.Parameterized;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Collection;
+
+public class UnifiedServerDiscoveryAndMonitoringTest extends UnifiedReactiveStreamsTest {
+ public UnifiedServerDiscoveryAndMonitoringTest(@SuppressWarnings("unused") final String fileDescription,
+ @SuppressWarnings("unused") final String testDescription,
+ final String schemaVersion,
+ @Nullable final BsonArray runOnRequirements, final BsonArray entities, final BsonArray initialData,
+ final BsonDocument definition) {
+ super(schemaVersion, runOnRequirements, entities, initialData, definition);
+ }
+
+ @Parameterized.Parameters(name = "{0}: {1}")
+ public static Collection