8000 Logical replication support by zilder · Pull Request #42 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

Logical replication support #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 1, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Additional subscription catchup test
  • Loading branch information
zilder committed Mar 27, 2018
commit bc1002f7ed82610900dcbdcd8404e8a6d842f01a
23 changes: 23 additions & 0 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,29 @@ def test_logical_replication(self):
res = node2.execute('select * from test2')
self.assertListEqual(res, [('a',), ('b',)])

@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
def test_logical_catchup(self):
""" Runs catchup for 100 times to be sure that it is consistent """
with get_new_node() as node1, get_new_node() as node2:
node1.init(allow_logical=True)
node1.start()
node2.init().start()

create_table = 'create table test (key int primary key, val int); '
node1.safe_psql(create_table)
node1.safe_psql('alter table test replica identity default')
node2.safe_psql(create_table)

# create publication / create subscription
sub = node2.subscribe(node1.publish('mypub'), 'mysub')

for i in range(0, 100):
node1.execute('insert into test values ({0}, {0})'.format(i))
sub.catchup()
res = node2.execute('select * from test')
self.assertListEqual(res, [(i, i,)])
node1.execute('delete from test')

@unittest.skipIf(pg_version_ge('10'), 'requires <10')
def test_logical_replication_fail(self):
with get_new_node() as node:
Expand Down
0