...

Text file src/go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/logging/connection-logging.json

Documentation: go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/logging

     1{
     2  "description": "connection-logging",
     3  "schemaVersion": "1.13",
     4  "runOnRequirements": [
     5    {
     6      "topologies": [
     7        "single"
     8      ]
     9    }
    10  ],
    11  "createEntities": [
    12    {
    13      "client": {
    14        "id": "failPointClient"
    15      }
    16    }
    17  ],
    18  "tests": [
    19    {
    20      "description": "Create a client, run a command, and close the client",
    21      "operations": [
    22        {
    23          "name": "createEntities",
    24          "object": "testRunner",
    25          "arguments": {
    26            "entities": [
    27              {
    28                "client": {
    29                  "id": "client",
    30                  "observeLogMessages": {
    31                    "connection": "debug"
    32                  }
    33                }
    34              }
    35            ]
    36          }
    37        },
    38        {
    39          "name": "listDatabases",
    40          "object": "client",
    41          "arguments": {
    42            "filter": {}
    43          }
    44        },
    45        {
    46          "name": "close",
    47          "object": "client"
    48        }
    49      ],
    50      "expectLogMessages": [
    51        {
    52          "client": "client",
    53          "messages": [
    54            {
    55              "level": "debug",
    56              "component": "connection",
    57              "data": {
    58                "message": "Connection pool created",
    59                "serverHost": {
    60                  "$$type": "string"
    61                },
    62                "serverPort": {
    63                  "$$type": [
    64                    "int",
    65                    "long"
    66                  ]
    67                }
    68              }
    69            },
    70            {
    71              "level": "debug",
    72              "component": "connection",
    73              "data": {
    74                "message": "Connection pool ready",
    75                "serverHost": {
    76                  "$$type": "string"
    77                },
    78                "serverPort": {
    79                  "$$type": [
    80                    "int",
    81                    "long"
    82                  ]
    83                }
    84              }
    85            },
    86            {
    87              "level": "debug",
    88              "component": "connection",
    89              "data": {
    90                "message": "Connection checkout started",
    91                "serverHost": {
    92                  "$$type": "string"
    93                },
    94                "serverPort": {
    95                  "$$type": [
    96                    "int",
    97                    "long"
    98                  ]
    99                }
   100              }
   101            },
   102            {
   103              "level": "debug",
   104              "component": "connection",
   105              "data": {
   106                "message": "Connection created",
   107                "driverConnectionId": {
   108                  "$$type": [
   109                    "int",
   110                    "long"
   111                  ]
   112                },
   113                "serverHost": {
   114                  "$$type": "string"
   115                },
   116                "serverPort": {
   117                  "$$type": [
   118                    "int",
   119                    "long"
   120                  ]
   121                }
   122              }
   123            },
   124            {
   125              "level": "debug",
   126              "component": "connection",
   127              "data": {
   128                "message": "Connection ready",
   129                "driverConnectionId": {
   130                  "$$type": [
   131                    "int",
   132                    "long"
   133                  ]
   134                },
   135                "serverHost": {
   136                  "$$type": "string"
   137                },
   138                "serverPort": {
   139                  "$$type": [
   140                    "int",
   141                    "long"
   142                  ]
   143                },
   144                "durationMS": {
   145                  "$$type": [
   146                    "double",
   147                    "int",
   148                    "long"
   149                  ]
   150                }
   151              }
   152            },
   153            {
   154              "level": "debug",
   155              "component": "connection",
   156              "data": {
   157                "message": "Connection checked out",
   158                "driverConnectionId": {
   159                  "$$type": [
   160                    "int",
   161                    "long"
   162                  ]
   163                },
   164                "serverHost": {
   165                  "$$type": "string"
   166                },
   167                "serverPort": {
   168                  "$$type": [
   169                    "int",
   170                    "long"
   171                  ]
   172                },
   173                "durationMS": {
   174                  "$$type": [
   175                    "double",
   176                    "int",
   177                    "long"
   178                  ]
   179                }
   180              }
   181            },
   182            {
   183              "level": "debug",
   184              "component": "connection",
   185              "data": {
   186                "message": "Connection checked in",
   187                "driverConnectionId": {
   188                  "$$type": [
   189                    "int",
   190                    "long"
   191                  ]
   192                },
   193                "serverHost": {
   194                  "$$type": "string"
   195                },
   196                "serverPort": {
   197                  "$$type": [
   198                    "int",
   199                    "long"
   200                  ]
   201                }
   202              }
   203            },
   204            {
   205              "level": "debug",
   206              "component": "connection",
   207              "data": {
   208                "message": "Connection checkout started",
   209                "serverHost": {
   210                  "$$type": "string"
   211                },
   212                "serverPort": {
   213                  "$$type": [
   214                    "int",
   215                    "long"
   216                  ]
   217                }
   218              }
   219            },
   220            {
   221              "level": "debug",
   222              "component": "connection",
   223              "data": {
   224                "message": "Connection checked out",
   225                "driverConnectionId": {
   226                  "$$type": [
   227                    "int",
   228                    "long"
   229                  ]
   230                },
   231                "serverHost": {
   232                  "$$type": "string"
   233                },
   234                "serverPort": {
   235                  "$$type": [
   236                    "int",
   237                    "long"
   238                  ]
   239                },
   240                "durationMS": {
   241                  "$$type": [
   242                    "double",
   243                    "int",
   244                    "long"
   245                  ]
   246                }
   247              }
   248            },
   249            {
   250              "level": "debug",
   251              "component": "connection",
   252              "data": {
   253                "message": "Connection checked in",
   254                "driverConnectionId": {
   255                  "$$type": [
   256                    "int",
   257                    "long"
   258                  ]
   259                },
   260                "serverHost": {
   261                  "$$type": "string"
   262                },
   263                "serverPort": {
   264                  "$$type": [
   265                    "int",
   266                    "long"
   267                  ]
   268                }
   269              }
   270            },
   271            {
   272              "level": "debug",
   273              "component": "connection",
   274              "data": {
   275                "message": "Connection closed",
   276                "driverConnectionId": {
   277                  "$$type": [
   278                    "int",
   279                    "long"
   280                  ]
   281                },
   282                "serverHost": {
   283                  "$$type": "string"
   284                },
   285                "serverPort": {
   286                  "$$type": [
   287                    "int",
   288                    "long"
   289                  ]
   290                },
   291                "reason": "Connection pool was closed"
   292              }
   293            },
   294            {
   295              "level": "debug",
   296              "component": "connection",
   297              "data": {
   298                "message": "Connection pool closed",
   299                "serverHost": {
   300                  "$$type": "string"
   301                },
   302                "serverPort": {
   303                  "$$type": [
   304                    "int",
   305                    "long"
   306                  ]
   307                }
   308              }
   309            }
   310          ]
   311        }
   312      ]
   313    },
   314    {
   315      "description": "Connection checkout fails due to error establishing connection",
   316      "runOnRequirements": [
   317        {
   318          "auth": true,
   319          "minServerVersion": "4.0"
   320        }
   321      ],
   322      "operations": [
   323        {
   324          "name": "createEntities",
   325          "object": "testRunner",
   326          "arguments": {
   327            "entities": [
   328              {
   329                "client": {
   330                  "id": "client",
   331                  "uriOptions": {
   332                    "retryReads": false,
   333                    "appname": "clientAppName",
   334                    "heartbeatFrequencyMS": 10000
   335                  },
   336                  "observeLogMessages": {
   337                    "connection": "debug"
   338                  }
   339                }
   340              }
   341            ]
   342          }
   343        },
   344        {
   345          "name": "failPoint",
   346          "object": "testRunner",
   347          "arguments": {
   348            "client": "failPointClient",
   349            "failPoint": {
   350              "configureFailPoint": "failCommand",
   351              "mode": {
   352                "times": 1
   353              },
   354              "data": {
   355                "failCommands": [
   356                  "saslContinue"
   357                ],
   358                "closeConnection": true,
   359                "appName": "clientAppName"
   360              }
   361            }
   362          }
   363        },
   364        {
   365          "name": "listDatabases",
   366          "object": "client",
   367          "arguments": {
   368            "filter": {}
   369          },
   370          "expectError": {
   371            "isClientError": true
   372          }
   373        }
   374      ],
   375      "expectLogMessages": [
   376        {
   377          "client": "client",
   378          "messages": [
   379            {
   380              "level": "debug",
   381              "component": "connection",
   382              "data": {
   383                "message": "Connection pool created",
   384                "serverHost": {
   385                  "$$type": "string"
   386                },
   387                "serverPort": {
   388                  "$$type": [
   389                    "int",
   390                    "long"
   391                  ]
   392                }
   393              }
   394            },
   395            {
   396              "level": "debug",
   397              "component": "connection",
   398              "data": {
   399                "message": "Connection pool ready",
   400                "serverHost": {
   401                  "$$type": "string"
   402                },
   403                "serverPort": {
   404                  "$$type": [
   405                    "int",
   406                    "long"
   407                  ]
   408                }
   409              }
   410            },
   411            {
   412              "level": "debug",
   413              "component": "connection",
   414              "data": {
   415                "message": "Connection checkout started",
   416                "serverHost": {
   417                  "$$type": "string"
   418                },
   419                "serverPort": {
   420                  "$$type": [
   421                    "int",
   422                    "long"
   423                  ]
   424                }
   425              }
   426            },
   427            {
   428              "level": "debug",
   429              "component": "connection",
   430              "data": {
   431                "message": "Connection created",
   432                "driverConnectionId": {
   433                  "$$type": [
   434                    "int",
   435                    "long"
   436                  ]
   437                },
   438                "serverHost": {
   439                  "$$type": "string"
   440                },
   441                "serverPort": {
   442                  "$$type": [
   443                    "int",
   444                    "long"
   445                  ]
   446                }
   447              }
   448            },
   449            {
   450              "level": "debug",
   451              "component": "connection",
   452              "data": {
   453                "message": "Connection pool cleared",
   454                "serverHost": {
   455                  "$$type": "string"
   456                },
   457                "serverPort": {
   458                  "$$type": [
   459                    "int",
   460                    "long"
   461                  ]
   462                }
   463              }
   464            },
   465            {
   466              "level": "debug",
   467              "component": "connection",
   468              "unordered": true,
   469              "data": {
   470                "message": "Connection closed",
   471                "driverConnectionId": {
   472                  "$$type": [
   473                    "int",
   474                    "long"
   475                  ]
   476                },
   477                "serverHost": {
   478                  "$$type": "string"
   479                },
   480                "serverPort": {
   481                  "$$type": [
   482                    "int",
   483                    "long"
   484                  ]
   485                },
   486                "reason": "An error occurred while using the connection",
   487                "error": {
   488                  "$$exists": true
   489                }
   490              }
   491            },
   492            {
   493              "level": "debug",
   494              "component": "connection",
   495              "unordered": true,
   496              "data": {
   497                "message": "Connection checkout failed",
   498                "serverHost": {
   499                  "$$type": "string"
   500                },
   501                "serverPort": {
   502                  "$$type": [
   503                    "int",
   504                    "long"
   505                  ]
   506                },
   507                "reason": "An error occurred while trying to establish a new connection",
   508                "error": {
   509                  "$$exists": true
   510                },
   511                "durationMS": {
   512                  "$$type": [
   513                    "double",
   514                    "int",
   515                    "long"
   516                  ]
   517                }
   518              }
   519            }
   520          ]
   521        }
   522      ]
   523    }
   524  ]
   525}

View as plain text