Exemple #1
0
    def test_pool_args(self):
        with pytest.raises(NotConnectError):
            ConnectionPool(uri="tcp://123.456.780.0:9999",
                           pool_size=10,
                           try_connect=True)

        with pytest.raises(NotConnectError):
            ConnectionPool(uri="tcp://123.456.780.0:9999",
                           pool_size=10,
                           try_connect=False)
Exemple #2
0
    def test_pool_max_conn(self):
        pool = ConnectionPool(uri="tcp://127.0.0.1:19530", pool_size=10)

        def run(_pool):
            conn = _pool.fetch()
            assert conn.conn_id() < 10
            conn.has_collection("test_pool")

        thread_list = []
        for _ in range(10 * 3):
            thread = threading.Thread(target=run, args=(pool, ))
            thread.start()
            thread_list.append(thread)
Exemple #3
0
    def test_pool_max_conn(self, gip):
        ip_, port_ = gip
        pool = ConnectionPool(uri=f"tcp://{ip_}:{port_}", pool_size=10)

        def run(_pool):
            conn = _pool.fetch()
            assert conn.conn_id() < 10
            conn.has_collection("test_pool")

        thread_list = []
        for _ in range(10 * 3):
            thread = threading.Thread(target=run, args=(pool,))
            thread.start()
            thread_list.append(thread)