...

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

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

     1runOn:
     2    -
     3        minServerVersion: "3.6"
     4        topology: ["replicaset"]
     5
     6data:
     7    - { _id: 1, x: 11 }
     8    - { _id: 2, x: 22 }
     9
    10tests:
    11    -
    12        description: "FindOneAndReplace is committed on first attempt"
    13        failPoint:
    14            configureFailPoint: onPrimaryTransactionalWrite
    15            mode: { times: 1 }
    16        operation:
    17            name: "findOneAndReplace"
    18            arguments:
    19                filter: { _id: 1 }
    20                replacement: { _id: 1, x: 111 }
    21                returnDocument: "Before"
    22        outcome:
    23            result: { _id: 1, x: 11 }
    24            collection:
    25                data:
    26                    - { _id: 1, x: 111 }
    27                    - { _id: 2, x: 22 }
    28    -
    29        description: "FindOneAndReplace is not committed on first attempt"
    30        failPoint:
    31            configureFailPoint: onPrimaryTransactionalWrite
    32            mode: { times: 1 }
    33            data: { failBeforeCommitExceptionCode: 1 }
    34        operation:
    35            name: "findOneAndReplace"
    36            arguments:
    37                filter: { _id: 1 }
    38                replacement: { _id: 1, x: 111 }
    39                returnDocument: "Before"
    40        outcome:
    41            result: { _id: 1, x: 11 }
    42            collection:
    43                data:
    44                    - { _id: 1, x: 111 }
    45                    - { _id: 2, x: 22 }
    46    -
    47        description: "FindOneAndReplace is never committed"
    48        failPoint:
    49            configureFailPoint: onPrimaryTransactionalWrite
    50            mode: { times: 2 }
    51            data: { failBeforeCommitExceptionCode: 1 }
    52        operation:
    53            name: "findOneAndReplace"
    54            arguments:
    55                filter: { _id: 1 }
    56                replacement: { _id: 1, x: 111 }
    57                returnDocument: "Before"
    58        outcome:
    59            error: true
    60            collection:
    61                data:
    62                    - { _id: 1, x: 11 }
    63                    - { _id: 2, x: 22 }

View as plain text