MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_standby_pool_01

Method test_standby_pool_01

tests/test_pool.py:1655–1669  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1653 return pg_pool.create_pool(loop=self.loop, **conn_spec)
1654
1655 async def test_standby_pool_01(self):
1656 for n in {1, 3, 5, 10, 20, 100}:
1657 with self.subTest(tasksnum=n):
1658 pool = await self.create_pool(
1659 database='postgres', user='postgres',
1660 init_size=5, min_size=0, max_size=10)
1661
1662 async def worker():
1663 con = await pool.acquire()
1664 self.assertEqual(await con.fetchval('SELECT 1'), 1)
1665 await pool.release(con)
1666
1667 tasks = [worker() for _ in range(n)]
1668 await asyncio.gather(*tasks)
1669 await pool.close()
1670
1671 async def test_standby_cursors(self):
1672 con = await self.standby_cluster.connect(

Callers

nothing calls this directly

Calls 2

create_poolMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected