...

Text file src/go.mongodb.org/mongo-driver/testdata/server-selection/logging/standalone.json

Documentation: go.mongodb.org/mongo-driver/testdata/server-selection/logging

     1{
     2  "description": "standalone-logging",
     3  "schemaVersion": "1.14",
     4  "runOnRequirements": [
     5    {
     6      "topologies": [
     7        "single"
     8      ]
     9    }
    10  ],
    11  "createEntities": [
    12    {
    13      "client": {
    14        "id": "client",
    15        "uriOptions": {
    16          "retryWrites": false,
    17          "heartbeatFrequencyMS": 500,
    18          "appName": "loggingClient",
    19          "serverSelectionTimeoutMS": 2000
    20        },
    21        "observeLogMessages": {
    22          "serverSelection": "debug"
    23        },
    24        "observeEvents": [
    25          "serverDescriptionChangedEvent",
    26          "topologyDescriptionChangedEvent"
    27        ]
    28      }
    29    },
    30    {
    31      "database": {
    32        "id": "database",
    33        "client": "client",
    34        "databaseName": "logging-tests"
    35      }
    36    },
    37    {
    38      "collection": {
    39        "id": "collection",
    40        "database": "database",
    41        "collectionName": "server-selection"
    42      }
    43    },
    44    {
    45      "client": {
    46        "id": "failPointClient"
    47      }
    48    }
    49  ],
    50  "tests": [
    51    {
    52      "description": "A successful operation",
    53      "operations": [
    54        {
    55          "name": "waitForEvent",
    56          "object": "testRunner",
    57          "arguments": {
    58            "client": "client",
    59            "event": {
    60              "topologyDescriptionChangedEvent": {}
    61            },
    62            "count": 2
    63          }
    64        },
    65        {
    66          "name": "insertOne",
    67          "object": "collection",
    68          "arguments": {
    69            "document": {
    70              "x": 1
    71            }
    72          }
    73        }
    74      ],
    75      "expectLogMessages": [
    76        {
    77          "client": "client",
    78          "messages": [
    79            {
    80              "level": "debug",
    81              "component": "serverSelection",
    82              "data": {
    83                "message": "Server selection started",
    84                "selector": {
    85                  "$$exists": true
    86                },
    87                "operation": "insert",
    88                "topologyDescription": {
    89                  "$$exists": true
    90                }
    91              }
    92            },
    93            {
    94              "level": "debug",
    95              "component": "serverSelection",
    96              "data": {
    97                "message": "Server selection succeeded",
    98                "selector": {
    99                  "$$exists": true
   100                },
   101                "operation": "insert",
   102                "topologyDescription": {
   103                  "$$exists": true
   104                },
   105                "serverHost": {
   106                  "$$type": "string"
   107                },
   108                "serverPort": {
   109                  "$$type": [
   110                    "int",
   111                    "long"
   112                  ]
   113                }
   114              }
   115            }
   116          ]
   117        }
   118      ]
   119    },
   120    {
   121      "description": "Failure due to unreachable server",
   122      "runOnRequirements": [
   123        {
   124          "minServerVersion": "4.4"
   125        }
   126      ],
   127      "operations": [
   128        {
   129          "name": "failPoint",
   130          "object": "testRunner",
   131          "arguments": {
   132            "client": "failPointClient",
   133            "failPoint": {
   134              "configureFailPoint": "failCommand",
   135              "mode": "alwaysOn",
   136              "data": {
   137                "failCommands": [
   138                  "hello",
   139                  "ismaster"
   140                ],
   141                "appName": "loggingClient",
   142                "closeConnection": true
   143              }
   144            }
   145          }
   146        },
   147        {
   148          "name": "waitForEvent",
   149          "object": "testRunner",
   150          "arguments": {
   151            "client": "client",
   152            "event": {
   153              "serverDescriptionChangedEvent": {
   154                "newDescription": {
   155                  "type": "Unknown"
   156                }
   157              }
   158            },
   159            "count": 1
   160          }
   161        },
   162        {
   163          "name": "insertOne",
   164          "object": "collection",
   165          "arguments": {
   166            "document": {
   167              "x": 1
   168            }
   169          },
   170          "expectError": {
   171            "isClientError": true
   172          }
   173        }
   174      ],
   175      "expectLogMessages": [
   176        {
   177          "client": "client",
   178          "messages": [
   179            {
   180              "level": "debug",
   181              "component": "serverSelection",
   182              "data": {
   183                "message": "Server selection started",
   184                "selector": {
   185                  "$$exists": true
   186                },
   187                "operation": "insert",
   188                "topologyDescription": {
   189                  "$$exists": true
   190                }
   191              }
   192            },
   193            {
   194              "level": "info",
   195              "component": "serverSelection",
   196              "data": {
   197                "message": "Waiting for suitable server to become available",
   198                "selector": {
   199                  "$$exists": true
   200                },
   201                "operation": "insert",
   202                "topologyDescription": {
   203                  "$$exists": true
   204                },
   205                "remainingTimeMS": {
   206                  "$$type": [
   207                    "int",
   208                    "long"
   209                  ]
   210                }
   211              }
   212            },
   213            {
   214              "level": "debug",
   215              "component": "serverSelection",
   216              "data": {
   217                "message": "Server selection failed",
   218                "selector": {
   219                  "$$exists": true
   220                },
   221                "operation": "insert",
   222                "topologyDescription": {
   223                  "$$exists": true
   224                },
   225                "failure": {
   226                  "$$exists": true
   227                }
   228              }
   229            }
   230          ]
   231        }
   232      ]
   233    }
   234  ]
   235}

View as plain text