...

Text file src/go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass/poc-command-monitoring.yml

Documentation: go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass

     1description: "poc-command-monitoring"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      observeEvents:
     9        - commandStartedEvent
    10        - commandSucceededEvent
    11        - commandFailedEvent
    12  - database:
    13      id: &database0 database0
    14      client: *client0
    15      databaseName: &database0Name command-monitoring-tests
    16  - collection:
    17      id: &collection0 collection0
    18      database: *database0
    19      collectionName: &collection0Name test
    20
    21initialData:
    22  - collectionName: *collection0Name
    23    databaseName: *database0Name
    24    documents:
    25      - { _id: 1, x: 11 }
    26      - { _id: 2, x: 22 }
    27      - { _id: 3, x: 33 }
    28      - { _id: 4, x: 44 }
    29      - { _id: 5, x: 55 }
    30
    31tests:
    32  - description: "A successful find event with a getmore and the server kills the cursor (<= 4.4)"
    33    runOnRequirements:
    34      - minServerVersion: "3.1"
    35        maxServerVersion: "4.4.99"
    36        topologies: [ single, replicaset ]
    37    operations:
    38      - name: find
    39        object: *collection0
    40        arguments:
    41          filter: { _id: { $gte: 1 }}
    42          sort: { _id: 1 }
    43          batchSize: 3
    44          limit: 4
    45    expectEvents:
    46      - client: *client0
    47        events:
    48          - commandStartedEvent:
    49              command:
    50                find: *collection0Name
    51                filter: { _id: { $gte : 1 } }
    52                sort: { _id: 1 }
    53                batchSize: 3
    54                limit: 4
    55              commandName: find
    56              databaseName: *database0Name
    57          - commandSucceededEvent:
    58              reply:
    59                ok: 1
    60                cursor:
    61                  id: { $$type: [ int, long ] }
    62                  ns: &namespace command-monitoring-tests.test
    63                  firstBatch:
    64                    - { _id: 1, x: 11 }
    65                    - { _id: 2, x: 22 }
    66                    - { _id: 3, x: 33 }
    67              commandName: find
    68          - commandStartedEvent:
    69              command:
    70                getMore: { $$type: [ int, long ] }
    71                collection: *collection0Name
    72                batchSize: 1
    73              commandName: getMore
    74              databaseName: *database0Name
    75          - commandSucceededEvent:
    76              reply:
    77                ok: 1
    78                cursor:
    79                  id: 0
    80                  ns: *namespace
    81                  nextBatch:
    82                    - { _id: 4, x: 44 }
    83              commandName: getMore
    84
    85  - description: "A failed find event"
    86    operations:
    87      - name: find
    88        object: *collection0
    89        arguments:
    90          filter: { $or: true }
    91        expectError: { isError: true }
    92    expectEvents:
    93      - client: *client0
    94        events:
    95          - commandStartedEvent:
    96              command:
    97                find: *collection0Name
    98                filter: { $or: true }
    99              commandName: find
   100              databaseName: *database0Name
   101          - commandFailedEvent:
   102              commandName: find

View as plain text