Exemple #1
0
async def test_aio_client_ssl():
    docker_rm_etcd_ssl()
    _, port, _ = docker_run_etcd_ssl()
    time.sleep(2)
    aio_client = AioClient(host, port, cert=(CERT_PATH, KEY_PATH), verify=CA_PATH)
    assert await aio_client.call_rpc('/kv/range', {'key': 'test_key'})
    docker_rm_etcd_ssl()
async def aio_client(event_loop, request):
    """
    init Etcd3Client, close its connection-pool when teardown
    """

    c = AioClient(host, port, protocol)

    def teardown():
        async def _t():
            await c.close()

        event_loop.run_until_complete(_t())
        event_loop._close()

    request.addfinalizer(teardown)
    return c