...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/bulkWrite-errorResponse.yml

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

     1description: "bulkWrite-errorResponse"
     2
     3schemaVersion: "1.12"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      useMultipleMongoses: false
     9  - database:
    10      id: &database0 database0
    11      client: *client0
    12      databaseName: &database0Name crud-tests
    13  - collection:
    14      id: &collection0 collection0
    15      database: *database0
    16      collectionName: &collection0Name test
    17
    18tests:
    19  # This test intentionally executes only a single insert operation in the bulk
    20  # write to make the error code and response assertions less ambiguous. That
    21  # said, some drivers may still need to skip this test because the CRUD spec
    22  # does not prescribe how drivers should formulate a BulkWriteException beyond
    23  # collecting write and write concern errors.
    24  - description: "bulkWrite operations support errorResponse assertions"
    25    runOnRequirements:
    26      - minServerVersion: "4.0.0"
    27        topologies: [ single, replicaset ]
    28      - minServerVersion: "4.2.0"
    29        topologies: [ sharded ]
    30    operations:
    31      - name: failPoint
    32        object: testRunner
    33        arguments:
    34          client: *client0
    35          failPoint:
    36            configureFailPoint: failCommand
    37            mode: { times: 1 }
    38            data:
    39              failCommands: [ insert ]
    40              errorCode: &errorCode 8 # UnknownError
    41      - name: bulkWrite
    42        object: *collection0
    43        arguments:
    44          requests:
    45            - insertOne:
    46                document: { _id: 1 }
    47        expectError:
    48          errorCode: *errorCode
    49          errorResponse:
    50            code: *errorCode

View as plain text