...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/logging/no-handshake-messages.yml

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

     1description: "no-handshake-command-logs"
     2
     3schemaVersion: "1.13"
     4
     5tests:
     6  - description: "Handshake commands should not generate log messages"
     7    operations:
     8      - name: createEntities
     9        object: testRunner
    10        arguments:
    11          entities:
    12            - client:
    13                id: &client client
    14                observeLogMessages:
    15                  command: debug
    16                observeEvents:
    17                  - connectionCreatedEvent
    18                  - connectionReadyEvent
    19            - database:
    20                id: &database database
    21                client: *client
    22                databaseName: &databaseName logging-tests
    23      - name: runCommand
    24        object: *database
    25        arguments:
    26          command: { ping: 1 }
    27          commandName: &commandName ping
    28      - name: waitForEvent
    29        object: testRunner
    30        arguments:
    31          client: *client
    32          event:
    33            connectionCreatedEvent: {}
    34          count: 1
    35      - name: waitForEvent
    36        object: testRunner
    37        arguments:
    38          client: *client
    39          event:
    40            connectionReadyEvent: {}
    41          count: 1
    42    expectLogMessages:
    43      # since the ping happens after the handshake, seeing events for only the ping
    44      # implies the driver did not emit any log messages for the handshake.
    45      - client: *client
    46        messages:
    47          - level: debug
    48            component: command
    49            data:
    50              message: "Command started"
    51              databaseName: *databaseName
    52              commandName: *commandName
    53
    54          - level: debug
    55            component: command
    56            data:
    57              message: "Command succeeded"
    58              commandName: *commandName

View as plain text