...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/logging/driver-connection-id.yml

Documentation: go.mongodb.org/mongo-driver/testdata/command-monitoring/logging

     1# This is a separate test so that drivers that do not implement CMAP can easily skip it.
     2description: "driver-connection-id"
     3
     4schemaVersion: "1.13"
     5
     6createEntities:
     7  - client:
     8      id: &client client
     9      observeLogMessages:
    10        command: debug
    11  - database:
    12      id: &database database
    13      client: *client
    14      databaseName: &databaseName logging-tests
    15  - collection:
    16      id: &collection collection
    17      database: *database
    18      collectionName: &collectionName logging-tests-collection
    19
    20initialData:
    21  - collectionName: *collectionName
    22    databaseName: *databaseName
    23    documents:
    24      - { _id: 1, x: 11 }
    25
    26tests:
    27  - description: "A successful command"
    28    operations:
    29      - name: runCommand
    30        object: *database
    31        arguments:
    32          command: { ping: 1 }
    33          commandName: &commandName ping
    34    expectLogMessages:
    35      - client: *client
    36        messages:
    37          - level: debug
    38            component: command
    39            data:
    40              message: "Command started"
    41              databaseName: *databaseName
    42              commandName: *commandName
    43              driverConnectionId: { $$type: [int, long] }
    44
    45          - level: debug
    46            component: command
    47            data:
    48              message: "Command succeeded"
    49              commandName: *commandName
    50              driverConnectionId: { $$type: [int, long] }
    51
    52  - description: "A failed command"
    53    operations:
    54      - name: &commandName find
    55        object: *collection
    56        arguments:
    57          filter: { $or: true }
    58        expectError:
    59          isClientError: false
    60    expectLogMessages:
    61      - client: *client
    62        messages:
    63          - level: debug
    64            component: command
    65            data:
    66              message: "Command started"
    67              databaseName: *databaseName
    68              commandName: *commandName
    69              driverConnectionId: { $$type: [int, long] }
    70
    71          - level: debug
    72            component: command
    73            data:
    74              message: "Command failed"
    75              commandName: *commandName
    76              driverConnectionId: { $$type: [int, long] }

View as plain text