runOn:
    -
        minServerVersion: "4.0"
        topology: ["replicaset"]
    -
        minServerVersion: "4.1.7"
        topology: ["sharded"]

data:
    - { _id: 1, x: 11 }

tests:
    -
        description: "InsertMany succeeds after PrimarySteppedDown"
        failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
                failCommands: ["insert"]
                errorCode: 189
        operation:
            name: "insertMany"
            arguments:
                documents:
                    - { _id: 2, x: 22 }
                    - { _id: 3, x: 33 }
                options: { ordered: true }
        outcome:
            result:
                insertedIds: { 0: 2, 1: 3 }
            collection:
                data:
                    - { _id: 1, x: 11 }
                    - { _id: 2, x: 22 }
                    - { _id: 3, x: 33 }
    -
        description: "InsertMany succeeds after WriteConcernError ShutdownInProgress"
        failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
                failCommands: ["insert"]
                writeConcernError:
                    code: 91
                    errmsg: Replication is being shut down
        operation:
            name: "insertMany"
            arguments:
                documents:
                    - { _id: 2, x: 22 }
                    - { _id: 3, x: 33 }
                options: { ordered: true }
        outcome:
            result:
                insertedIds: { 0: 2, 1: 3 }
            collection:
                data:
                    - { _id: 1, x: 11 }
                    - { _id: 2, x: 22 }
                    - { _id: 3, x: 33 }