{
  "description": "connection-pool-options",
  "schemaVersion": "1.13",
  "runOnRequirements": [
    {
      "topologies": [
        "single"
      ]
    }
  ],
  "tests": [
    {
      "description": "Options should be included in connection pool created message when specified",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "connectionReadyEvent"
                  ],
                  "observeLogMessages": {
                    "connection": "debug"
                  },
                  "uriOptions": {
                    "minPoolSize": 1,
                    "maxPoolSize": 5,
                    "maxIdleTimeMS": 10000
                  }
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "connectionReadyEvent": {}
            },
            "count": 1
          }
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool created",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "minPoolSize": 1,
                "maxPoolSize": 5,
                "maxIdleTimeMS": 10000
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool ready",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection created",
                "driverConnectionId": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection ready",
                "driverConnectionId": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "durationMS": {
                  "$$type": [
                    "double",
                    "int",
                    "long"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "maxConnecting should be included in connection pool created message when specified",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "poolReadyEvent"
                  ],
                  "observeLogMessages": {
                    "connection": "debug"
                  },
                  "uriOptions": {
                    "maxConnecting": 5
                  }
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "poolReadyEvent": {}
            },
            "count": 1
          }
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool created",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "maxConnecting": 5
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool ready",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "waitQueueTimeoutMS should be included in connection pool created message when specified",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "poolReadyEvent"
                  ],
                  "observeLogMessages": {
                    "connection": "debug"
                  },
                  "uriOptions": {
                    "waitQueueTimeoutMS": 10000
                  }
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "poolReadyEvent": {}
            },
            "count": 1
          }
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool created",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "waitQueueTimeoutMS": 10000
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool ready",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "waitQueueSize should be included in connection pool created message when specified",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "poolReadyEvent"
                  ],
                  "observeLogMessages": {
                    "connection": "debug"
                  },
                  "uriOptions": {
                    "waitQueueSize": 100
                  }
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "poolReadyEvent": {}
            },
            "count": 1
          }
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool created",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "waitQueueSize": 100
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool ready",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    {
      "description": "waitQueueMultiple should be included in connection pool created message when specified",
      "operations": [
        {
          "name": "createEntities",
          "object": "testRunner",
          "arguments": {
            "entities": [
              {
                "client": {
                  "id": "client",
                  "observeEvents": [
                    "poolReadyEvent"
                  ],
                  "observeLogMessages": {
                    "connection": "debug"
                  },
                  "uriOptions": {
                    "waitQueueSize": 5
                  }
                }
              }
            ]
          }
        },
        {
          "name": "waitForEvent",
          "object": "testRunner",
          "arguments": {
            "client": "client",
            "event": {
              "poolReadyEvent": {}
            },
            "count": 1
          }
        }
      ],
      "expectLogMessages": [
        {
          "client": "client",
          "messages": [
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool created",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                },
                "waitQueueMultiple": 5
              }
            },
            {
              "level": "debug",
              "component": "connection",
              "data": {
                "message": "Connection pool ready",
                "serverHost": {
                  "$$type": "string"
                },
                "serverPort": {
                  "$$type": [
                    "int",
                    "long"
                  ]
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
