{
  "runOn": [
    {
      "minServerVersion": "4.9",
      "topology": [
        "replicaset",
        "sharded"
      ]
    }
  ],
  "database_name": "sdam-tests",
  "collection_name": "pool-cleared-error",
  "data": [],
  "tests": [
    {
      "description": "PoolClearedError does not mark server unknown",
      "clientOptions": {
        "retryWrites": true,
        "maxPoolSize": 1,
        "appname": "poolClearedErrorTest"
      },
      "operations": [
        {
          "name": "insertOne",
          "object": "collection",
          "arguments": {
            "document": {
              "_id": 1
            }
          }
        },
        {
          "name": "configureFailPoint",
          "object": "testRunner",
          "arguments": {
            "failPoint": {
              "configureFailPoint": "failCommand",
              "mode": {
                "times": 1
              },
              "data": {
                "failCommands": [
                  "insert"
                ],
                "blockConnection": true,
                "blockTimeMS": 100,
                "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"
          }
        },
        {
          "name": "startThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread6"
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread1",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 2
                }
              }
            }
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread2",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 3
                }
              }
            }
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread3",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 4
                }
              }
            }
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread4",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 5
                }
              }
            }
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread5",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 6
                }
              }
            }
          }
        },
        {
          "name": "runOnThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread6",
            "operation": {
              "name": "insertOne",
              "object": "collection",
              "arguments": {
                "document": {
                  "_id": 7
                }
              }
            }
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread1"
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread2"
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread3"
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread4"
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread5"
          }
        },
        {
          "name": "waitForThread",
          "object": "testRunner",
          "arguments": {
            "name": "thread6"
          }
        },
        {
          "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": 8
            }
          }
        },
        {
          "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
            },
            {
              "_id": 4
            },
            {
              "_id": 5
            },
            {
              "_id": 6
            },
            {
              "_id": 7
            },
            {
              "_id": 8
            }
          ]
        }
      }
    }
  ]
}
