...

Text file src/go.mongodb.org/mongo-driver/testdata/load-balancers/event-monitoring.yml

Documentation: go.mongodb.org/mongo-driver/testdata/load-balancers

     1description: monitoring events include correct fields
     2
     3schemaVersion: '1.3'
     4
     5runOnRequirements:
     6  - topologies: [ load-balanced ]
     7
     8createEntities:
     9  - client:
    10      id: &client0 client0
    11      useMultipleMongoses: true
    12      uriOptions:
    13        retryReads: false
    14      observeEvents:
    15        - commandStartedEvent
    16        - commandSucceededEvent
    17        - commandFailedEvent
    18        - poolClearedEvent
    19  - database:
    20      id: &database0 database0
    21      client: *client0
    22      databaseName: &database0Name database0
    23  - collection:
    24      id: &collection0 collection0
    25      database: *database0
    26      collectionName: &collection0Name coll0
    27
    28initialData:
    29  - databaseName: *database0Name
    30    collectionName: *collection0Name
    31    documents: []
    32
    33tests:
    34  - description: command started and succeeded events include serviceId
    35    operations:
    36      - name: insertOne
    37        object: *collection0
    38        arguments:
    39          document: { x: 1 }
    40    expectEvents:
    41      - client: *client0
    42        events:
    43          - commandStartedEvent:
    44              commandName: insert
    45              hasServiceId: true
    46          - commandSucceededEvent:
    47              commandName: insert
    48              hasServiceId: true
    49
    50  - description: command failed events include serviceId
    51    operations:
    52      - name: find
    53        object: *collection0
    54        arguments:
    55          filter: { $or: true }
    56        expectError:
    57          isError: true
    58    expectEvents:
    59      - client: *client0
    60        events:
    61          - commandStartedEvent:
    62              commandName: find
    63              hasServiceId: true
    64          - commandFailedEvent:
    65              commandName: find
    66              hasServiceId: true
    67
    68  - description: poolClearedEvent events include serviceId
    69    operations:
    70      - name: failPoint
    71        object: testRunner
    72        arguments:
    73          client: *client0
    74          failPoint:
    75            configureFailPoint: failCommand
    76            mode: { times: 1 }
    77            data:
    78              failCommands: [find]
    79              closeConnection: true
    80      - name: find
    81        object: *collection0
    82        arguments:
    83          filter: {}
    84        expectError:
    85          isClientError: true
    86    expectEvents:
    87      - client: *client0
    88        events:
    89          - commandStartedEvent:
    90              commandName: find
    91              hasServiceId: true
    92          - commandFailedEvent:
    93              commandName: find
    94              hasServiceId: true
    95      - client: *client0
    96        eventType: cmap
    97        events:
    98          - poolClearedEvent:
    99              hasServiceId: true

View as plain text