{
  "description": "loadbalanced-logging",
  "schemaVersion": "1.16",
  "runOnRequirements": [
    {
      "topologies": [
        "load-balanced"
      ],
      "minServerVersion": "4.4"
    }
  ],
  "tests": [
    {
      "description": "Topology lifecycle",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeLogMessages": {
                    "topology": "debug"
                  },
                  "observeEvents": [
                    "topologyDescriptionChangedEvent"
                  ]
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "topologyDescriptionChangedEvent": {}
            },
            "count": 2
          }
        },
        {
          "name": "close",
          "object": "client"
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Starting topology monitoring",
                "topologyId": {
                  "$$exists": true
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Topology description changed",
                "topologyId": {
                  "$$exists": true
                },
                "previousDescription": {
                  "$$exists": true
                },
                "newDescription": {
                  "$$exists": true
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Starting server monitoring",
                "topologyId": {
                  "$$exists": true
                },
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Topology description changed",
                "topologyId": {
                  "$$exists": true
                },
                "previousDescription": {
                  "$$exists": true
                },
                "newDescription": {
                  "$$exists": true
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Stopped server monitoring",
                "topologyId": {
                  "$$exists": true
                },
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Topology description changed",
                "topologyId": {
                  "$$exists": true
                },
                "previousDescription": {
                  "$$exists": true
                },
                "newDescription": {
                  "$$exists": true
                }
              }
            },
            {
              "level": "debug",
              "component": "topology",
              "data": {
                "message": "Stopped topology monitoring",
                "topologyId": {
                  "$$exists": true
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
