{
  "description": "connectTimeoutMS",
  "schemaVersion": "1.4",
  "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
            }
          ]
        }
      ]
    }
  ]
}
