...

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

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

     1description: "retryable-writes insertOne serverErrors"
     2
     3schemaVersion: "1.0"
     4
     5runOnRequirements:
     6  - minServerVersion: "3.6"
     7    topologies: [ replicaset ]
     8
     9createEntities:
    10  - client:
    11      id: &client0 client0
    12      useMultipleMongoses: false
    13      observeEvents: [ commandStartedEvent ]
    14  - database:
    15      id: &database0 database0
    16      client: *client0
    17      databaseName: &databaseName retryable-writes-tests
    18  - collection:
    19      id: &collection0 collection0
    20      database: *database0
    21      collectionName: &collectionName coll
    22
    23initialData:
    24  - collectionName: *collectionName
    25    databaseName: *databaseName
    26    documents:
    27      - { _id: 1, x: 11 }
    28      - { _id: 2, x: 22 }
    29
    30tests:
    31  - description: "InsertOne succeeds after retryable writeConcernError"
    32    runOnRequirements:
    33      - minServerVersion: "4.0"
    34        topologies: [ replicaset ]
    35      - minServerVersion: "4.1.7"
    36        topologies: [ sharded-replicaset ]
    37    operations:
    38      - name: failPoint
    39        object: testRunner
    40        arguments:
    41          client: *client0
    42          failPoint:
    43            configureFailPoint: failCommand
    44            mode: { times: 1 }
    45            data:
    46              failCommands: [ insert ]
    47              errorLabels: [RetryableWriteError] # top-level error labels
    48              writeConcernError:
    49                code: 91 # ShutdownInProgress
    50                errmsg: "Replication is being shut down"
    51      - name: insertOne
    52        object: *collection0
    53        arguments:
    54          document: { _id: 3, x: 33 }
    55        expectResult:
    56          $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } }
    57    expectEvents:
    58      - client: *client0
    59        events:
    60          - commandStartedEvent:
    61              command:
    62                insert: *collectionName
    63                documents: [{ _id: 3, x: 33 }]
    64              commandName: insert
    65              databaseName: *databaseName
    66          - commandStartedEvent:
    67              command:
    68                insert: *collectionName
    69                documents: [{ _id: 3, x: 33 }]
    70              commandName: insert
    71              databaseName: *databaseName
    72    outcome:
    73      - collectionName: *collectionName
    74        databaseName: *databaseName
    75        documents:
    76          - { _id: 1, x: 11 }
    77          - { _id: 2, x: 22 }
    78          - { _id: 3, x: 33 }  # The write was still applied

View as plain text