Skip to content

Commit bc1002f

Browse files
committed
Additional subscription catchup test
1 parent f652bf4 commit bc1002f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_simple.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,29 @@ def test_logical_replication(self):
457457
res = node2.execute('select * from test2')
458458
self.assertListEqual(res, [('a',), ('b',)])
459459

460+
@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
461+
def test_logical_catchup(self):
462+
""" Runs catchup for 100 times to be sure that it is consistent """
463+
with get_new_node() as node1, get_new_node() as node2:
464+
node1.init(allow_logical=True)
465+
node1.start()
466+
node2.init().start()
467+
468+
create_table = 'create table test (key int primary key, val int); '
469+
node1.safe_psql(create_table)
470+
node1.safe_psql('alter table test replica identity default')
471+
node2.safe_psql(create_table)
472+
473+
# create publication / create subscription
474+
sub = node2.subscribe(node1.publish('mypub'), 'mysub')
475+
476+
for i in range(0, 100):
477+
node1.execute('insert into test values ({0}, {0})'.format(i))
478+
sub.catchup()
479+
res = node2.execute('select * from test')
480+
self.assertListEqual(res, [(i, i,)])
481+
node1.execute('delete from test')
482+
460483
@unittest.skipIf(pg_version_ge('10'), 'requires <10')
461484
def test_logical_replication_fail(self):
462485
with get_new_node() as node:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy