...

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

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

     1{
     2  "description": "poc-command-monitoring",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "observeEvents": [
     9          "commandStartedEvent",
    10          "commandSucceededEvent",
    11          "commandFailedEvent"
    12        ]
    13      }
    14    },
    15    {
    16      "database": {
    17        "id": "database0",
    18        "client": "client0",
    19        "databaseName": "command-monitoring-tests"
    20      }
    21    },
    22    {
    23      "collection": {
    24        "id": "collection0",
    25        "database": "database0",
    26        "collectionName": "test"
    27      }
    28    }
    29  ],
    30  "initialData": [
    31    {
    32      "collectionName": "test",
    33      "databaseName": "command-monitoring-tests",
    34      "documents": [
    35        {
    36          "_id": 1,
    37          "x": 11
    38        },
    39        {
    40          "_id": 2,
    41          "x": 22
    42        },
    43        {
    44          "_id": 3,
    45          "x": 33
    46        },
    47        {
    48          "_id": 4,
    49          "x": 44
    50        },
    51        {
    52          "_id": 5,
    53          "x": 55
    54        }
    55      ]
    56    }
    57  ],
    58  "tests": [
    59    {
    60      "description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)",
    61      "runOnRequirements": [
    62        {
    63          "minServerVersion": "3.1",
    64          "maxServerVersion": "4.4.99",
    65          "topologies": [
    66            "single",
    67            "replicaset"
    68          ]
    69        }
    70      ],
    71      "operations": [
    72        {
    73          "name": "find",
    74          "object": "collection0",
    75          "arguments": {
    76            "filter": {
    77              "_id": {
    78                "$gte": 1
    79              }
    80            },
    81            "sort": {
    82              "_id": 1
    83            },
    84            "batchSize": 3,
    85            "limit": 4
    86          }
    87        }
    88      ],
    89      "expectEvents": [
    90        {
    91          "client": "client0",
    92          "events": [
    93            {
    94              "commandStartedEvent": {
    95                "command": {
    96                  "find": "test",
    97                  "filter": {
    98                    "_id": {
    99                      "$gte": 1
   100                    }
   101                  },
   102                  "sort": {
   103                    "_id": 1
   104                  },
   105                  "batchSize": 3,
   106                  "limit": 4
   107                },
   108                "commandName": "find",
   109                "databaseName": "command-monitoring-tests"
   110              }
   111            },
   112            {
   113              "commandSucceededEvent": {
   114                "reply": {
   115                  "ok": 1,
   116                  "cursor": {
   117                    "id": {
   118                      "$$type": [
   119                        "int",
   120                        "long"
   121                      ]
   122                    },
   123                    "ns": "command-monitoring-tests.test",
   124                    "firstBatch": [
   125                      {
   126                        "_id": 1,
   127                        "x": 11
   128                      },
   129                      {
   130                        "_id": 2,
   131                        "x": 22
   132                      },
   133                      {
   134                        "_id": 3,
   135                        "x": 33
   136                      }
   137                    ]
   138                  }
   139                },
   140                "commandName": "find"
   141              }
   142            },
   143            {
   144              "commandStartedEvent": {
   145                "command": {
   146                  "getMore": {
   147                    "$$type": [
   148                      "int",
   149                      "long"
   150                    ]
   151                  },
   152                  "collection": "test",
   153                  "batchSize": 1
   154                },
   155                "commandName": "getMore",
   156                "databaseName": "command-monitoring-tests"
   157              }
   158            },
   159            {
   160              "commandSucceededEvent": {
   161                "reply": {
   162                  "ok": 1,
   163                  "cursor": {
   164                    "id": 0,
   165                    "ns": "command-monitoring-tests.test",
   166                    "nextBatch": [
   167                      {
   168                        "_id": 4,
   169                        "x": 44
   170                      }
   171                    ]
   172                  }
   173                },
   174                "commandName": "getMore"
   175              }
   176            }
   177          ]
   178        }
   179      ]
   180    },
   181    {
   182      "description": "A failed find event",
   183      "operations": [
   184        {
   185          "name": "find",
   186          "object": "collection0",
   187          "arguments": {
   188            "filter": {
   189              "$or": true
   190            }
   191          },
   192          "expectError": {
   193            "isError": true
   194          }
   195        }
   196      ],
   197      "expectEvents": [
   198        {
   199          "client": "client0",
   200          "events": [
   201            {
   202              "commandStartedEvent": {
   203                "command": {
   204                  "find": "test",
   205                  "filter": {
   206                    "$or": true
   207                  }
   208                },
   209                "commandName": "find",
   210                "databaseName": "command-monitoring-tests"
   211              }
   212            },
   213            {
   214              "commandFailedEvent": {
   215                "commandName": "find"
   216              }
   217            }
   218          ]
   219        }
   220      ]
   221    }
   222  ]
   223}

View as plain text