{
  "runOn": [
    {
      "minServerVersion": "4.0",
      "topology": [
        "replicaset"
      ]
    },
    {
      "minServerVersion": "4.1.7",
      "topology": [
        "sharded",
        "load-balanced"
      ]
    }
  ],
  "data": [
    {
      "_id": 1,
      "x": 11
    },
    {
      "_id": 2,
      "x": 22
    }
  ],
  "tests": [
    {
      "description": "InsertOne succeeds after connection failure",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "closeConnection": true
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "result": {
          "insertedId": 3
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 33
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne fails after connection failure when retryWrites option is false",
      "clientOptions": {
        "retryWrites": false
      },
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "closeConnection": true
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "result": {
          "errorLabelsOmit": [
            "RetryableWriteError"
          ]
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne fails after Interrupted",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 11601,
          "closeConnection": false
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "result": {
          "errorLabelsOmit": [
            "RetryableWriteError"
          ]
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne fails after WriteConcernError Interrupted",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 11601,
            "errmsg": "operation was interrupted"
          }
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "result": {
          "errorLabelsOmit": [
            "RetryableWriteError"
          ]
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 33
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne fails after WriteConcernError WriteConcernFailed",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 64,
            "codeName": "WriteConcernFailed",
            "errmsg": "waiting for replication timed out",
            "errInfo": {
              "wtimeout": true
            }
          }
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "result": {
          "errorLabelsOmit": [
            "RetryableWriteError"
          ]
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 33
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne fails with a RetryableWriteError label after two connection failures",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 2
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "closeConnection": true
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "result": {
          "errorLabelsContain": [
            "RetryableWriteError"
          ]
        },
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            }
          ]
        }
      }
    }
  ]
}
