Skip to content

Commit

Permalink
Add a test for cursors on a standby replica.
Browse files Browse the repository at this point in the history
Closes: #66.
  • Loading branch information
elprans committed Sep 12, 2017
1 parent 93bf26f commit c484a47
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ async def worker(pool):


@unittest.skipIf(os.environ.get('PGHOST'), 'using remote cluster for testing')
class TestHostStandby(tb.ConnectedTestCase):
class TestHotStandby(tb.ConnectedTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -681,3 +681,14 @@ async def worker():
tasks = [worker() for _ in range(n)]
await asyncio.gather(*tasks, loop=self.loop)
await pool.close()

async def test_standby_cursors(self):
con = await self.standby_cluster.connect(
database='postgres', loop=self.loop)

try:
async with con.transaction():
cursor = await con.cursor('SELECT 1')
self.assertEqual(await cursor.fetchrow(), (1,))
finally:
await con.close()

0 comments on commit c484a47

Please sign in to comment.