...

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

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

     1{
     2  "description": "command-logging",
     3  "schemaVersion": "1.13",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client",
     8        "observeLogMessages": {
     9          "command": "debug"
    10        }
    11      }
    12    },
    13    {
    14      "database": {
    15        "id": "database",
    16        "client": "client",
    17        "databaseName": "logging-tests"
    18      }
    19    },
    20    {
    21      "collection": {
    22        "id": "collection",
    23        "database": "database",
    24        "collectionName": "logging-tests-collection"
    25      }
    26    }
    27  ],
    28  "initialData": [
    29    {
    30      "collectionName": "logging-tests-collection",
    31      "databaseName": "logging-tests",
    32      "documents": [
    33        {
    34          "_id": 1,
    35          "x": 11
    36        }
    37      ]
    38    }
    39  ],
    40  "tests": [
    41    {
    42      "description": "A successful command",
    43      "operations": [
    44        {
    45          "name": "runCommand",
    46          "object": "database",
    47          "arguments": {
    48            "command": {
    49              "ping": 1
    50            },
    51            "commandName": "ping"
    52          }
    53        }
    54      ],
    55      "expectLogMessages": [
    56        {
    57          "client": "client",
    58          "messages": [
    59            {
    60              "level": "debug",
    61              "component": "command",
    62              "data": {
    63                "message": "Command started",
    64                "databaseName": "logging-tests",
    65                "commandName": "ping",
    66                "command": {
    67                  "$$matchAsDocument": {
    68                    "$$matchAsRoot": {
    69                      "ping": 1,
    70                      "$db": "logging-tests"
    71                    }
    72                  }
    73                },
    74                "requestId": {
    75                  "$$type": [
    76                    "int",
    77                    "long"
    78                  ]
    79                },
    80                "serverHost": {
    81                  "$$type": "string"
    82                },
    83                "serverPort": {
    84                  "$$type": [
    85                    "int",
    86                    "long"
    87                  ]
    88                }
    89              }
    90            },
    91            {
    92              "level": "debug",
    93              "component": "command",
    94              "data": {
    95                "message": "Command succeeded",
    96                "databaseName": "logging-tests",
    97                "commandName": "ping",
    98                "reply": {
    99                  "$$type": "string"
   100                },
   101                "requestId": {
   102                  "$$type": [
   103                    "int",
   104                    "long"
   105                  ]
   106                },
   107                "serverHost": {
   108                  "$$type": "string"
   109                },
   110                "serverPort": {
   111                  "$$type": [
   112                    "int",
   113                    "long"
   114                  ]
   115                },
   116                "durationMS": {
   117                  "$$type": [
   118                    "double",
   119                    "int",
   120                    "long"
   121                  ]
   122                }
   123              }
   124            }
   125          ]
   126        }
   127      ]
   128    },
   129    {
   130      "description": "A failed command",
   131      "operations": [
   132        {
   133          "name": "find",
   134          "object": "collection",
   135          "arguments": {
   136            "filter": {
   137              "$or": true
   138            }
   139          },
   140          "expectError": {
   141            "isClientError": false
   142          }
   143        }
   144      ],
   145      "expectLogMessages": [
   146        {
   147          "client": "client",
   148          "messages": [
   149            {
   150              "level": "debug",
   151              "component": "command",
   152              "data": {
   153                "message": "Command started",
   154                "databaseName": "logging-tests",
   155                "commandName": "find",
   156                "command": {
   157                  "$$type": "string"
   158                },
   159                "requestId": {
   160                  "$$type": [
   161                    "int",
   162                    "long"
   163                  ]
   164                },
   165                "serverHost": {
   166                  "$$type": "string"
   167                },
   168                "serverPort": {
   169                  "$$type": [
   170                    "int",
   171                    "long"
   172                  ]
   173                }
   174              }
   175            },
   176            {
   177              "level": "debug",
   178              "component": "command",
   179              "data": {
   180                "message": "Command failed",
   181                "databaseName": "logging-tests",
   182                "commandName": "find",
   183                "failure": {
   184                  "$$exists": true
   185                },
   186                "requestId": {
   187                  "$$type": [
   188                    "int",
   189                    "long"
   190                  ]
   191                },
   192                "serverHost": {
   193                  "$$type": "string"
   194                },
   195                "serverPort": {
   196                  "$$type": [
   197                    "int",
   198                    "long"
   199                  ]
   200                },
   201                "durationMS": {
   202                  "$$type": [
   203                    "double",
   204                    "int",
   205                    "long"
   206                  ]
   207                }
   208              }
   209            }
   210          ]
   211        }
   212      ]
   213    }
   214  ]
   215}

View as plain text