...

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

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

     1description: "command"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     6  - client:
     7      id: &client client
     8      observeEvents:
     9        - commandStartedEvent
    10        - commandSucceededEvent
    11        - commandFailedEvent
    12  - database:
    13      id: &database database
    14      client: *client
    15      databaseName: &databaseName command-monitoring-tests
    16  - collection:
    17      id: &collection collection
    18      database: *database
    19      collectionName: &collectionName test
    20
    21initialData:
    22  - collectionName: *collectionName
    23    databaseName: *databaseName
    24    documents:
    25      - { _id: 1, x: 11 }
    26
    27tests:
    28  - description: "A successful command"
    29    operations:
    30      - name: runCommand
    31        object: *database
    32        arguments:
    33          command: { ping: 1 }
    34          commandName: ping
    35    expectEvents:
    36      - client: *client
    37        events:
    38          - commandStartedEvent:
    39              command:
    40                ping: 1
    41              commandName: ping
    42              databaseName: *databaseName
    43          - commandSucceededEvent:
    44              reply:
    45                ok: 1
    46              commandName: ping
    47
    48# The legacy "A failed command event" test was removed in the test conversion, as the
    49# behavior when a command fails is already covered by the test "A failed find event"
    50# in find.yml.

View as plain text