Skip to content

Commit c484a47

Browse files
committed
Add a test for cursors on a standby replica.
Closes: #66.
1 parent 93bf26f commit c484a47

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_pool.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ async def worker(pool):
614614

615615

616616
@unittest.skipIf(os.environ.get('PGHOST'), 'using remote cluster for testing')
617-
class TestHostStandby(tb.ConnectedTestCase):
617+
class TestHotStandby(tb.ConnectedTestCase):
618618
@classmethod
619619
def setUpClass(cls):
620620
super().setUpClass()
@@ -681,3 +681,14 @@ async def worker():
681681
tasks = [worker() for _ in range(n)]
682682
await asyncio.gather(*tasks, loop=self.loop)
683683
await pool.close()
684+
685+
async def test_standby_cursors(self):
686+
con = await self.standby_cluster.connect(
687+
database='postgres', loop=self.loop)
688+
689+
try:
690+
async with con.transaction():
691+
cursor = await con.cursor('SELECT 1')
692+
self.assertEqual(await cursor.fetchrow(), (1,))
693+
finally:
694+
await con.close()

0 commit comments

Comments
 (0)