{
  "description": "minPoolSize-error",
  "schemaVersion": "1.4",
  "runOnRequirements": [
    {
      "minServerVersion": "4.4.7",
      "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
          }
        }
      ]
    }
  ]
}
