...

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

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

     1description: "no-heartbeat-command-logs"
     2
     3schemaVersion: "1.13"
     4
     5# no heartbeats in load balanced mode.
     6runOnRequirements:
     7  - topologies:
     8      - single
     9      - replicaset
    10      - sharded
    11
    12tests:
    13  - description: "Heartbeat commands should not generate log messages"
    14    operations:
    15      - name: createEntities
    16        object: testRunner
    17        arguments:
    18          entities:
    19            - client:
    20                id: &client client
    21                observeLogMessages:
    22                  command: debug
    23                observeEvents:
    24                  - serverDescriptionChangedEvent
    25            - database:
    26                id: &database database
    27                client: *client
    28                databaseName: &databaseName logging-tests
    29      - name: waitForEvent
    30        object: testRunner
    31        arguments:
    32          client: *client
    33          event:
    34            # a server description change implies that a heartbeat has happened.
    35            serverDescriptionChangedEvent: {}
    36          count: 1
    37      - name: runCommand
    38        object: *database
    39        arguments:
    40          command: { ping: 1 }
    41          commandName: &commandName ping
    42    expectLogMessages:
    43      # since the ping happens after the heartbeat, seeing events for only the ping
    44      # implies the driver did not emit a log message for the heartbeat.
    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