Skip to content

Commit

Permalink
new tests on query session pool
Browse files Browse the repository at this point in the history
  • Loading branch information
vgvoleg committed Aug 22, 2024
1 parent 972732d commit 4a5c58e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/aio/query/test_query_session_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,22 @@ async def test_pool_recreates_bad_sessions(self, pool: QuerySessionPoolAsync):
async with pool.checkout() as session:
assert session_id != session._state.session_id
assert pool._current_size == 1

@pytest.mark.asyncio
async def test_acquire_from_closed_pool_raises(self, pool: QuerySessionPoolAsync):
await pool.stop()
with pytest.raises(RuntimeError):
await pool.acquire(1)

@pytest.mark.asyncio
async def test_no_session_leak(self, driver, docker_project):
pool = ydb.aio.QuerySessionPoolAsync(driver, 1)
docker_project.stop()
try:
await pool.acquire(timeout=0.5)
except ydb.Error:
pass
assert pool._current_size == 0

docker_project.start()
await pool.stop()

0 comments on commit 4a5c58e

Please sign in to comment.