...

Text file src/go.mongodb.org/mongo-driver/testdata/change-streams/change-streams-errors.yml

Documentation: go.mongodb.org/mongo-driver/testdata/change-streams

     1description: "change-streams-errors"
     2
     3schemaVersion: "1.7"
     4
     5runOnRequirements:
     6  - serverless: forbid
     7
     8createEntities:
     9  - client:
    10      id: &client0 client0
    11      observeEvents: [ commandStartedEvent ]
    12      ignoreCommandMonitoringEvents: [ killCursors ]
    13      useMultipleMongoses: false
    14  - client:
    15      id: &globalClient globalClient
    16      useMultipleMongoses: false
    17  - database:
    18      id: &database0 database0
    19      client: *client0
    20      databaseName: *database0
    21  - collection:
    22      id: &collection0 collection0
    23      database: *database0
    24      collectionName: *collection0
    25  - database:
    26      id: &globalDatabase0 globalDatabase0
    27      client: *globalClient
    28      databaseName: *database0
    29  - collection:
    30      id: &globalCollection0 globalCollection0
    31      database: *globalDatabase0
    32      collectionName: *collection0
    33
    34initialData:
    35  - collectionName: *collection0
    36    databaseName: *database0
    37    documents: []
    38
    39tests:
    40  - description: "The watch helper must not throw a custom exception when executed against a single server topology, but instead depend on a server error"
    41    runOnRequirements:
    42      - minServerVersion: "3.6.0"
    43        topologies: [ single ]
    44    operations:
    45      - name: createChangeStream
    46        object: *collection0
    47        arguments: { pipeline: [] }
    48        expectError: { errorCode: 40573 }
    49
    50  - description: Change Stream should error when an invalid aggregation stage is passed in
    51    runOnRequirements:
    52      - minServerVersion: "3.6.0"
    53        topologies: [ replicaset ]
    54    operations:
    55      - name: createChangeStream
    56        object: *collection0
    57        arguments:
    58          pipeline: [ { $unsupported: foo } ]
    59        expectError: { errorCode: 40324 }
    60    expectEvents:
    61      - client: *client0
    62        ignoreExtraEvents: true
    63        events:
    64          - commandStartedEvent:
    65              command:
    66                aggregate: *collection0
    67                cursor: {}
    68                pipeline:
    69                  - $changeStream: {}
    70                  - $unsupported: foo
    71              commandName: aggregate
    72              databaseName: *database0
    73
    74  - description: Change Stream should error when _id is projected out
    75    runOnRequirements:
    76      - minServerVersion: "4.1.11"
    77        topologies: [ replicaset, sharded-replicaset, load-balanced ]
    78    operations:
    79      - name: createChangeStream
    80        object: *collection0
    81        arguments:
    82          pipeline:
    83            - $project: { _id: 0 }
    84        saveResultAsEntity: &changeStream0 changeStream0
    85      - name: insertOne
    86        object: *globalCollection0
    87        arguments:
    88          document: { z: 3 }
    89      - name: iterateUntilDocumentOrError
    90        object: *changeStream0
    91        expectError: { errorCode: 280 }
    92
    93  - description: change stream errors on ElectionInProgress
    94    runOnRequirements:
    95      - minServerVersion: "4.2"
    96        topologies: [ replicaset, sharded-replicaset, load-balanced ]
    97    operations:
    98      - name: failPoint
    99        object: testRunner
   100        arguments:
   101          client: *globalClient
   102          failPoint:
   103            configureFailPoint: failCommand
   104            mode: { times: 1 }
   105            data:
   106              failCommands: [ getMore ]
   107              errorCode: 216
   108              closeConnection: false
   109      - name: createChangeStream
   110        object: *collection0
   111        arguments:
   112          pipeline: []
   113        saveResultAsEntity: &changeStream0 changeStream0
   114      - name: insertOne
   115        object: *globalCollection0
   116        arguments:
   117          document: { z: 3 }
   118      - name: iterateUntilDocumentOrError
   119        object: *changeStream0
   120        expectError: { errorCode: 216 }

View as plain text