{
  "runOn": [
    {
      "minServerVersion": "4.0",
      "topology": [
        "replicaset"
      ]
    },
    {
      "minServerVersion": "4.1.7",
      "topology": [
        "sharded"
      ]
    }
  ],
  "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 succeeds after NotMaster",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 10107,
          "closeConnection": false
        }
      },
      "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 succeeds after NotMasterOrSecondary",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 13436,
          "closeConnection": false
        }
      },
      "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 succeeds after NotMasterNoSlaveOk",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 13435,
          "closeConnection": false
        }
      },
      "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 succeeds after InterruptedDueToStepDown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 11602,
          "closeConnection": false
        }
      },
      "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 succeeds after InterruptedAtShutdown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 11600,
          "closeConnection": false
        }
      },
      "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 succeeds after PrimarySteppedDown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 189,
          "closeConnection": false
        }
      },
      "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 succeeds after ShutdownInProgress",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 91,
          "closeConnection": false
        }
      },
      "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 succeeds after HostNotFound",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 7,
          "closeConnection": false
        }
      },
      "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 succeeds after HostUnreachable",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 6,
          "closeConnection": false
        }
      },
      "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 succeeds after SocketException",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 9001,
          "closeConnection": false
        }
      },
      "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 succeeds after NetworkTimeout",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "errorCode": 89,
          "closeConnection": false
        }
      },
      "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 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,
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            }
          ]
        }
      }
    },
    {
      "description": "InsertOne succeeds after WriteConcernError InterruptedAtShutdown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 11600,
            "errmsg": "Replication is being shut down"
          }
        }
      },
      "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 succeeds after WriteConcernError InterruptedDueToStepDown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 11602,
            "errmsg": "Replication is being shut down"
          }
        }
      },
      "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 succeeds after WriteConcernError PrimarySteppedDown",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 189,
            "errmsg": "Replication is being shut down"
          }
        }
      },
      "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 succeeds after WriteConcernError ShutdownInProgress",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 91,
            "errmsg": "Replication is being shut down"
          }
        }
      },
      "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 multiple retryable writeConcernErrors",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 2
        },
        "data": {
          "failCommands": [
            "insert"
          ],
          "writeConcernError": {
            "code": 91,
            "errmsg": "Replication is being shut down"
          }
        }
      },
      "operation": {
        "name": "insertOne",
        "arguments": {
          "document": {
            "_id": 3,
            "x": 33
          }
        }
      },
      "outcome": {
        "error": true,
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 33
            }
          ]
        }
      }
    },
    {
      "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,
        "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,
        "collection": {
          "data": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 33
            }
          ]
        }
      }
    }
  ]
}
