...

Text file src/go.mongodb.org/mongo-driver/testdata/load-balancers/event-monitoring.json

Documentation: go.mongodb.org/mongo-driver/testdata/load-balancers

     1{
     2  "description": "monitoring events include correct fields",
     3  "schemaVersion": "1.3",
     4  "runOnRequirements": [
     5    {
     6      "topologies": [
     7        "load-balanced"
     8      ]
     9    }
    10  ],
    11  "createEntities": [
    12    {
    13      "client": {
    14        "id": "client0",
    15        "useMultipleMongoses": true,
    16        "uriOptions": {
    17          "retryReads": false
    18        },
    19        "observeEvents": [
    20          "commandStartedEvent",
    21          "commandSucceededEvent",
    22          "commandFailedEvent",
    23          "poolClearedEvent"
    24        ]
    25      }
    26    },
    27    {
    28      "database": {
    29        "id": "database0",
    30        "client": "client0",
    31        "databaseName": "database0"
    32      }
    33    },
    34    {
    35      "collection": {
    36        "id": "collection0",
    37        "database": "database0",
    38        "collectionName": "coll0"
    39      }
    40    }
    41  ],
    42  "initialData": [
    43    {
    44      "databaseName": "database0",
    45      "collectionName": "coll0",
    46      "documents": []
    47    }
    48  ],
    49  "tests": [
    50    {
    51      "description": "command started and succeeded events include serviceId",
    52      "operations": [
    53        {
    54          "name": "insertOne",
    55          "object": "collection0",
    56          "arguments": {
    57            "document": {
    58              "x": 1
    59            }
    60          }
    61        }
    62      ],
    63      "expectEvents": [
    64        {
    65          "client": "client0",
    66          "events": [
    67            {
    68              "commandStartedEvent": {
    69                "commandName": "insert",
    70                "hasServiceId": true
    71              }
    72            },
    73            {
    74              "commandSucceededEvent": {
    75                "commandName": "insert",
    76                "hasServiceId": true
    77              }
    78            }
    79          ]
    80        }
    81      ]
    82    },
    83    {
    84      "description": "command failed events include serviceId",
    85      "operations": [
    86        {
    87          "name": "find",
    88          "object": "collection0",
    89          "arguments": {
    90            "filter": {
    91              "$or": true
    92            }
    93          },
    94          "expectError": {
    95            "isError": true
    96          }
    97        }
    98      ],
    99      "expectEvents": [
   100        {
   101          "client": "client0",
   102          "events": [
   103            {
   104              "commandStartedEvent": {
   105                "commandName": "find",
   106                "hasServiceId": true
   107              }
   108            },
   109            {
   110              "commandFailedEvent": {
   111                "commandName": "find",
   112                "hasServiceId": true
   113              }
   114            }
   115          ]
   116        }
   117      ]
   118    },
   119    {
   120      "description": "poolClearedEvent events include serviceId",
   121      "operations": [
   122        {
   123          "name": "failPoint",
   124          "object": "testRunner",
   125          "arguments": {
   126            "client": "client0",
   127            "failPoint": {
   128              "configureFailPoint": "failCommand",
   129              "mode": {
   130                "times": 1
   131              },
   132              "data": {
   133                "failCommands": [
   134                  "find"
   135                ],
   136                "closeConnection": true
   137              }
   138            }
   139          }
   140        },
   141        {
   142          "name": "find",
   143          "object": "collection0",
   144          "arguments": {
   145            "filter": {}
   146          },
   147          "expectError": {
   148            "isClientError": true
   149          }
   150        }
   151      ],
   152      "expectEvents": [
   153        {
   154          "client": "client0",
   155          "events": [
   156            {
   157              "commandStartedEvent": {
   158                "commandName": "find",
   159                "hasServiceId": true
   160              }
   161            },
   162            {
   163              "commandFailedEvent": {
   164                "commandName": "find",
   165                "hasServiceId": true
   166              }
   167            }
   168          ]
   169        },
   170        {
   171          "client": "client0",
   172          "eventType": "cmap",
   173          "events": [
   174            {
   175              "poolClearedEvent": {
   176                "hasServiceId": true
   177              }
   178            }
   179          ]
   180        }
   181      ]
   182    }
   183  ]
   184}

View as plain text