{
  "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": 2
              },
              "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
              }
            ]
          }
        },
        {
          "name": "assertEventCount",
          "object": "testRunner",
          "arguments": {
            "event": "ServerMarkedUnknownEvent",
            "count": 1
          }
        },
        {
          "name": "assertEventCount",
          "object": "testRunner",
          "arguments": {
            "event": "PoolClearedEvent",
            "count": 1
          }
        }
      ],
      "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
            }
          ]
        }
      }
    }
  ]
}
