{
  "description": "loadbalanced-emit-topology-description-changed-before-close",
  "schemaVersion": "1.20",
  "runOnRequirements": [
    {
      "topologies": [
        "load-balanced"
      ],
      "minServerVersion": "4.4"
    }
  ],
  "tests": [
    {
      "description": "Topology lifecycle",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "topologyDescriptionChangedEvent",
                    "topologyOpeningEvent",
                    "topologyClosedEvent"
                  ]
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "topologyDescriptionChangedEvent": {}
            },
            "count": 2
          }
        },
        {
          "name": "close",
          "object": "client"
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "eventType": "sdam",
          "events": [
            {
              "topologyOpeningEvent": {}
            },
            {
              "topologyDescriptionChangedEvent": {
                "previousDescription": {
                  "type": "Unknown"
                },
                "newDescription": {}
              }
            },
            {
              "topologyDescriptionChangedEvent": {
                "newDescription": {
                  "type": "LoadBalanced"
                }
              }
            },
            {
              "topologyDescriptionChangedEvent": {
                "newDescription": {
                  "type": "Unknown"
                }
              }
            },
            {
              "topologyClosedEvent": {}
            }
          ]
        }
      ]
    }
  ]
}
