Skip to content

Commit 4a5c58e

Browse files
committed
new tests on query session pool
1 parent 972732d commit 4a5c58e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/aio/query/test_query_session_pool.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,22 @@ async def test_pool_recreates_bad_sessions(self, pool: QuerySessionPoolAsync):
9494
async with pool.checkout() as session:
9595
assert session_id != session._state.session_id
9696
assert pool._current_size == 1
97+
98+
@pytest.mark.asyncio
99+
async def test_acquire_from_closed_pool_raises(self, pool: QuerySessionPoolAsync):
100+
await pool.stop()
101+
with pytest.raises(RuntimeError):
102+
await pool.acquire(1)
103+
104+
@pytest.mark.asyncio
105+
async def test_no_session_leak(self, driver, docker_project):
106+
pool = ydb.aio.QuerySessionPoolAsync(driver, 1)
107+
docker_project.stop()
108+
try:
109+
await pool.acquire(timeout=0.5)
110+
except ydb.Error:
111+
pass
112+
assert pool._current_size == 0
113+
114+
docker_project.start()
115+
await pool.stop()

0 commit comments

Comments
 (0)