{
  "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
            }
          ]
        }
      }
    }
  ]
}
