summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-04-19 01:34:39 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-04-19 01:34:39 +0100
commit6e5abf33f257954e23127ae22befdbd51d94750c (patch)
treef0641a883726d316ea85d29572516b05ad130e1a /tests
parent9d7ff405ee39785d92dbd3e7374149955edd6315 (diff)
parent248e653c9e2ec2dfc0b1eac9561981b34a637f9d (diff)
downloadpsycopg2-6e5abf33f257954e23127ae22befdbd51d94750c.tar.gz
Merge branch 'fix-547'
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_replication.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_replication.py b/tests/test_replication.py
index 0aed578..182bff2 100755
--- a/tests/test_replication.py
+++ b/tests/test_replication.py
@@ -159,6 +159,29 @@ class ReplicationTest(ReplicationTestCase):
# try with correct command
cur.start_replication(slot_name=self.slot)
+ @skip_before_postgres(9, 4) # slots require 9.4
+ @skip_repl_if_green
+ def test_keepalive(self):
+ conn = self.repl_connect(connection_factory=LogicalReplicationConnection)
+ if conn is None:
+ return
+
+ cur = conn.cursor()
+
+ self.create_replication_slot(cur, output_plugin='test_decoding')
+
+ self.make_replication_events()
+
+ cur.start_replication(self.slot)
+
+ def consume(msg):
+ raise StopReplication()
+
+ self.assertRaises(StopReplication,
+ cur.consume_stream, consume, keepalive_interval=2)
+
+ conn.close()
+
@skip_before_postgres(9, 4) # slots require 9.4
@skip_repl_if_green
def test_stop_replication(self):