{
  "description": "connection establishment if loadBalanced is specified for non-load balanced clusters",
  "schemaVersion": "1.3",
  "runOnRequirements": [
    {
      "topologies": [
        "single",
        "sharded"
      ]
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "lbTrueClient",
        "useMultipleMongoses": false,
        "uriOptions": {
          "loadBalanced": true
        }
      }
    },
    {
      "database": {
        "id": "lbTrueDatabase",
        "client": "lbTrueClient",
        "databaseName": "lbTrueDb"
      }
    },
    {
      "client": {
        "id": "lbFalseClient",
        "uriOptions": {
          "loadBalanced": false
        }
      }
    },
    {
      "database": {
        "id": "lbFalseDatabase",
        "client": "lbFalseClient",
        "databaseName": "lbFalseDb"
      }
    }
  ],
  "_yamlAnchors": {
    "runCommandArguments": [
      {
        "arguments": {
          "commandName": "ping",
          "command": {
            "ping": 1
          }
        }
      }
    ]
  },
  "tests": [
    {
      "description": "operations against non-load balanced clusters fail if URI contains loadBalanced=true",
      "runOnRequirements": [
        {
          "maxServerVersion": "8.0.99",
          "topologies": [
            "single"
          ]
        },
        {
          "topologies": [
            "sharded"
          ]
        }
      ],
      "operations": [
        {
          "name": "runCommand",
          "object": "lbTrueDatabase",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          },
          "expectError": {
            "errorContains": "Driver attempted to initialize in load balancing mode, but the server does not support this mode"
          }
        }
      ]
    },
    {
      "description": "operations against non-load balanced clusters succeed if URI contains loadBalanced=false",
      "operations": [
        {
          "name": "runCommand",
          "object": "lbFalseDatabase",
          "arguments": {
            "commandName": "ping",
            "command": {
              "ping": 1
            }
          }
        }
      ]
    }
  ]
}
