...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/findOneAndReplace-serverErrors.yml

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy

     1runOn:
     2    -
     3        minServerVersion: "4.0"
     4        topology: ["replicaset"]
     5    -
     6        minServerVersion: "4.1.7"
     7        topology: ["sharded", "load-balanced"]
     8
     9data:
    10    - { _id: 1, x: 11 }
    11    - { _id: 2, x: 22 }
    12
    13tests:
    14    -
    15        description: "FindOneAndReplace succeeds after PrimarySteppedDown"
    16        failPoint:
    17            configureFailPoint: failCommand
    18            mode: { times: 1 }
    19            data:
    20                failCommands: ["findAndModify"]
    21                errorCode: 189
    22                errorLabels: ["RetryableWriteError"]
    23        operation:
    24            name: "findOneAndReplace"
    25            arguments:
    26                filter: { _id: 1 }
    27                replacement: { _id: 1, x: 111 }
    28                returnDocument: "Before"
    29        outcome:
    30            result: { _id: 1, x: 11 }
    31            collection:
    32                data:
    33                    - { _id: 1, x: 111 }
    34                    - { _id: 2, x: 22 }
    35    -
    36        description: "FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress"
    37        failPoint:
    38            configureFailPoint: failCommand
    39            mode: { times: 1 }
    40            data:
    41                failCommands: ["findAndModify"]
    42                writeConcernError:
    43                    code: 91
    44                    errmsg: Replication is being shut down
    45                    errorLabels: ["RetryableWriteError"]
    46        operation:
    47            name: "findOneAndReplace"
    48            arguments:
    49                filter: { _id: 1 }
    50                replacement: { _id: 1, x: 111 }
    51                returnDocument: "Before"
    52        outcome:
    53            result: { _id: 1, x: 11 }
    54            collection:
    55                data:
    56                    - { _id: 1, x: 111 }
    57                    - { _id: 2, x: 22 }
    58
    59    -
    60        description: "FindOneAndReplace fails with a RetryableWriteError label after two connection failures"
    61        failPoint:
    62            configureFailPoint: failCommand
    63            mode: { times: 2 }
    64            data:
    65                failCommands: ["findAndModify"]
    66                closeConnection: true
    67        operation:
    68            name: "findOneAndReplace"
    69            arguments:
    70                filter: { _id: 1 }
    71                replacement: { _id: 1, x: 111 }
    72                returnDocument: "Before"
    73        outcome:
    74            error: true
    75            result:
    76                errorLabelsContain: ["RetryableWriteError"]
    77            collection:
    78                data:
    79                    - { _id: 1, x: 11 }
    80                    - { _id: 2, x: 22 }

View as plain text