Total Complexity | 3 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import asyncio |
||
2 | import uuid |
||
3 | |||
4 | import pytest |
||
5 | |||
6 | from goblin.driver import GremlinServer |
||
7 | |||
8 | |||
9 | @pytest.mark.asyncio |
||
10 | async def test_client_auto_release(cluster): |
||
11 | client = await cluster.connect() |
||
12 | resp = await client.submit("1 + 1") |
||
13 | async for msg in resp: |
||
14 | pass |
||
15 | await asyncio.sleep(0) |
||
16 | host = cluster._hosts.popleft() |
||
17 | assert len(host._pool._available) == 1 |
||
18 | await host.close() |
||
19 | |||
20 | |||
21 | @pytest.mark.asyncio |
||
22 | async def test_alias(cluster): |
||
23 | client = await cluster.connect() |
||
24 | aliased_client = client.alias({"g": "g1"}) |
||
25 | assert aliased_client._aliases == {"g": "g1"} |
||
26 | assert aliased_client._cluster is client._cluster |
||
27 | assert aliased_client._loop is client._loop |
||
28 | await cluster.close() |
||
29 | |||
49 |