...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/updateOne.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: "UpdateOne is committed on first attempt"
    13        failPoint:
    14            configureFailPoint: onPrimaryTransactionalWrite
    15            mode: { times: 1 }
    16        operation:
    17            name: "updateOne"
    18            arguments:
    19                filter: { _id: 1 }
    20                update: { $inc: { x : 1 }}
    21        outcome:
    22            result:
    23                matchedCount: 1
    24                modifiedCount: 1
    25                upsertedCount: 0
    26            collection:
    27                data:
    28                    - { _id: 1, x: 12 }
    29                    - { _id: 2, x: 22 }
    30    -
    31        description: "UpdateOne is not committed on first attempt"
    32        failPoint:
    33            configureFailPoint: onPrimaryTransactionalWrite
    34            mode: { times: 1 }
    35            data: { failBeforeCommitExceptionCode: 1 }
    36        operation:
    37            name: "updateOne"
    38            arguments:
    39                filter: { _id: 1 }
    40                update: { $inc: { x : 1 }}
    41        outcome:
    42            result:
    43                matchedCount: 1
    44                modifiedCount: 1
    45                upsertedCount: 0
    46            collection:
    47                data:
    48                    - { _id: 1, x: 12 }
    49                    - { _id: 2, x: 22 }
    50    -
    51        description: "UpdateOne is never committed"
    52        failPoint:
    53            configureFailPoint: onPrimaryTransactionalWrite
    54            mode: { times: 2 }
    55            data: { failBeforeCommitExceptionCode: 1 }
    56        operation:
    57            name: "updateOne"
    58            arguments:
    59                filter: { _id: 1 }
    60                update: { $inc: { x : 1 }}
    61        outcome:
    62            error: true
    63            collection:
    64                data:
    65                    - { _id: 1, x: 11 }
    66                    - { _id: 2, x: 22 }
    67    -
    68        description: "UpdateOne with upsert is committed on first attempt"
    69        failPoint:
    70            configureFailPoint: onPrimaryTransactionalWrite
    71            mode: { times: 1 }
    72        operation:
    73            name: "updateOne"
    74            arguments:
    75                filter: { _id: 3, x: 33 }
    76                update: { $inc: { x : 1 }}
    77                upsert: true
    78        outcome:
    79            result:
    80                matchedCount: 0
    81                modifiedCount: 0
    82                upsertedCount: 1
    83                upsertedId: 3
    84            collection:
    85                data:
    86                    - { _id: 1, x: 11 }
    87                    - { _id: 2, x: 22 }
    88                    - { _id: 3, x: 34 }
    89    -
    90        description: "UpdateOne with upsert is not committed on first attempt"
    91        failPoint:
    92            configureFailPoint: onPrimaryTransactionalWrite
    93            mode: { times: 1 }
    94            data: { failBeforeCommitExceptionCode: 1 }
    95        operation:
    96            name: "updateOne"
    97            arguments:
    98                filter: { _id: 3, x: 33 }
    99                update: { $inc: { x : 1 }}
   100                upsert: true
   101        outcome:
   102            result:
   103                matchedCount: 0
   104                modifiedCount: 0
   105                upsertedCount: 1
   106                upsertedId: 3
   107            collection:
   108                data:
   109                    - { _id: 1, x: 11 }
   110                    - { _id: 2, x: 22 }
   111                    - { _id: 3, x: 34 }
   112    -
   113        description: "UpdateOne with upsert is never committed"
   114        failPoint:
   115            configureFailPoint: onPrimaryTransactionalWrite
   116            mode: { times: 2 }
   117            data: { failBeforeCommitExceptionCode: 1 }
   118        operation:
   119            name: "updateOne"
   120            arguments:
   121                filter: { _id: 3, x: 33 }
   122                update: { $inc: { x : 1 }}
   123                upsert: true
   124        outcome:
   125            error: true
   126            collection:
   127                data:
   128                    - { _id: 1, x: 11 }
   129                    - { _id: 2, x: 22 }

View as plain text