summaryrefslogtreecommitdiff
path: root/tests/test_replication.py
diff options
context:
space:
mode:
authorOleksandr Shulgin <oleksandr.shulgin@zalando.de>2016-01-05 12:31:57 +0100
committerOleksandr Shulgin <oleksandr.shulgin@zalando.de>2016-01-05 12:31:57 +0100
commit09a4bb70a168799a91f63f1c2039f456c485960f (patch)
treea6c08b7e079fe652dce69267928f030cb6c985c7 /tests/test_replication.py
parent4b9a6f48f33f9f80a1a12850f5029bf7ab97145b (diff)
downloadpsycopg2-09a4bb70a168799a91f63f1c2039f456c485960f.tar.gz
Allow retrying start_replication after syntax or data error.
Diffstat (limited to 'tests/test_replication.py')
-rw-r--r--tests/test_replication.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_replication.py b/tests/test_replication.py
index 4441a26..a316135 100644
--- a/tests/test_replication.py
+++ b/tests/test_replication.py
@@ -119,6 +119,18 @@ class ReplicationTest(ReplicationTestCase):
cur.start_replication(self.slot)
@skip_before_postgres(9, 4) # slots require 9.4
+ def test_start_and_recover_from_error(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.assertRaises(psycopg2.DataError, cur.start_replication,
+ slot_name=self.slot, options=dict(invalid_param='value'))
+ cur.start_replication(slot_name=self.slot)
+
+ @skip_before_postgres(9, 4) # slots require 9.4
def test_stop_replication(self):
conn = self.repl_connect(connection_factory=LogicalReplicationConnection)
if conn is None: return
@@ -162,6 +174,7 @@ class AsyncReplicationTest(ReplicationTestCase):
cur.send_feedback(flush_lsn=msg.data_start)
+ # cannot be used in asynchronous mode
self.assertRaises(psycopg2.ProgrammingError, cur.consume_stream, consume)
def process_stream():