...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/findOneAndUpdate.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: "FindOneAndUpdate is committed on first attempt"
    13        failPoint:
    14            configureFailPoint: onPrimaryTransactionalWrite
    15            mode: { times: 1 }
    16        operation:
    17            name: "findOneAndUpdate"
    18            arguments:
    19                filter: { _id: 1 }
    20                update: { $inc: { x : 1 }}
    21                returnDocument: "Before"
    22        outcome:
    23            result: { _id: 1, x: 11 }
    24            collection:
    25                data:
    26                    - { _id: 1, x: 12 }
    27                    - { _id: 2, x: 22 }
    28    -
    29        description: "FindOneAndUpdate is not committed on first attempt"
    30        failPoint:
    31            configureFailPoint: onPrimaryTransactionalWrite
    32            mode: { times: 1 }
    33            data: { failBeforeCommitExceptionCode: 1 }
    34        operation:
    35            name: "findOneAndUpdate"
    36            arguments:
    37                filter: { _id: 1 }
    38                update: { $inc: { x : 1 }}
    39                returnDocument: "Before"
    40        outcome:
    41            result: { _id: 1, x: 11 }
    42            collection:
    43                data:
    44                    - { _id: 1, x: 12 }
    45                    - { _id: 2, x: 22 }
    46    -
    47        description: "FindOneAndUpdate is never committed"
    48        failPoint:
    49            configureFailPoint: onPrimaryTransactionalWrite
    50            mode: { times: 2 }
    51            data: { failBeforeCommitExceptionCode: 1 }
    52        operation:
    53            name: "findOneAndUpdate"
    54            arguments:
    55                filter: { _id: 1 }
    56                update: { $inc: { x : 1 }}
    57        outcome:
    58            error: true
    59            collection:
    60                data:
    61                    - { _id: 1, x: 11 }
    62                    - { _id: 2, x: 22 }

View as plain text