...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/bulkWrite-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: "BulkWrite succeeds after PrimarySteppedDown"
    16        failPoint:
    17            configureFailPoint: failCommand
    18            mode: { times: 1 }
    19            data:
    20                failCommands: ["update"]
    21                errorCode: 189
    22                errorLabels: ["RetryableWriteError"]
    23        operation:
    24            name: "bulkWrite"
    25            arguments:
    26                requests:
    27                    -
    28                        name: "deleteOne"
    29                        arguments:
    30                            filter: { _id: 1 }
    31                    -
    32                        name: "insertOne"
    33                        arguments:
    34                            document: { _id: 3, x: 33 }
    35                    -
    36                        name: "updateOne"
    37                        arguments:
    38                            filter: { _id: 2 }
    39                            update: { $inc: { x : 1 }}
    40                options: { ordered: true }
    41        outcome:
    42            result:
    43                deletedCount: 1
    44                insertedCount: 1
    45                insertedIds: { 1: 3 }
    46                matchedCount: 1
    47                modifiedCount: 1
    48                upsertedCount: 0
    49                upsertedIds: { }
    50            collection:
    51                data:
    52                    - { _id: 2, x: 23 }
    53                    - { _id: 3, x: 33 }
    54    -
    55        description: "BulkWrite succeeds after WriteConcernError ShutdownInProgress"
    56        failPoint:
    57            configureFailPoint: failCommand
    58            mode: { times: 1 }
    59            data:
    60                failCommands: ["insert"]
    61                writeConcernError:
    62                    code: 91
    63                    errmsg: Replication is being shut down
    64                    errorLabels: ["RetryableWriteError"]
    65        operation:
    66            name: "bulkWrite"
    67            arguments:
    68                requests:
    69                    -
    70                        name: "deleteOne"
    71                        arguments:
    72                            filter: { _id: 1 }
    73                    -
    74                        name: "insertOne"
    75                        arguments:
    76                            document: { _id: 3, x: 33 }
    77                    -
    78                        name: "updateOne"
    79                        arguments:
    80                            filter: { _id: 2 }
    81                            update: { $inc: { x : 1 }}
    82                options: { ordered: true }
    83        outcome:
    84            result:
    85                deletedCount: 1
    86                insertedCount: 1
    87                insertedIds: { 1: 3 }
    88                matchedCount: 1
    89                modifiedCount: 1
    90                upsertedCount: 0
    91                upsertedIds: { }
    92            collection:
    93                data:
    94                    - { _id: 2, x: 23 }
    95                    - { _id: 3, x: 33 }
    96
    97    -
    98        description: "BulkWrite fails with a RetryableWriteError label after two connection failures"
    99        failPoint:
   100            configureFailPoint: failCommand
   101            mode: { times: 2 }
   102            data:
   103                failCommands: ["update"]
   104                closeConnection: true
   105        operation:
   106            name: "bulkWrite"
   107            arguments:
   108                requests:
   109                    -
   110                        name: "deleteOne"
   111                        arguments:
   112                            filter: { _id: 1 }
   113                    -
   114                        name: "insertOne"
   115                        arguments:
   116                            document: { _id: 3, x: 33 }
   117                    -
   118                        name: "updateOne"
   119                        arguments:
   120                            filter: { _id: 2 }
   121                            update: { $inc: { x : 1 }}
   122                options: { ordered: true }
   123        outcome:
   124          error: true
   125          result:
   126                errorLabelsContain: ["RetryableWriteError"]
   127          collection:
   128                data:
   129                    - { _id: 2, x: 22 }
   130                    - { _id: 3, x: 33 }

View as plain text