Skip to content

Commit b4d565f

Browse files
committed
Fix tests for dry-run option. Add test dry-run for DELTA backup
1 parent 4d6a3e9 commit b4d565f

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ env:
4040
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
4141
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE MODE=catchup
4242
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE PTRACK_PATCH_PG_BRANCH=REL_11_STABLE MODE=catchup
43-
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE PTRACK_PATCH_PG_BRANCH=REL_10_STABLE MODE=catchup
43+
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=catchup
4444
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
4545
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
4646
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking

tests/catchup.py

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,21 +1466,16 @@ def test_dry_run_catchup_full(self):
14661466
# preparation 1: source
14671467
src_pg = self.make_simple_node(
14681468
base_dir = os.path.join(module_name, self.fname, 'src'),
1469-
set_replication = True,
1470-
pg_options = { 'wal_log_hints': 'on' }
1469+
set_replication = True
14711470
)
14721471
src_pg.slow_start()
14731472

14741473
# preparation 2: make clean shutdowned lagging behind replica
14751474
dst_pg = self.make_empty_node(os.path.join(module_name, self.fname, 'dst'))
14761475

1477-
src_pg.safe_psql(
1478-
"postgres",
1479-
"CREATE TABLE ultimate_question(answer int)")
14801476
src_pg.pgbench_init(scale = 10)
14811477
pgbench = src_pg.pgbench(options=['-T', '10', '--no-vacuum'])
14821478
pgbench.wait()
1483-
src_pg.safe_psql("postgres", "INSERT INTO ultimate_question VALUES(42)")
14841479

14851480
# save the condition before dry-run
14861481
content_before = self.pgdata_content(dst_pg.data_dir)
@@ -1501,30 +1496,25 @@ def test_dry_run_catchup_full(self):
15011496

15021497
# Cleanup
15031498
src_pg.stop()
1504-
dst_pg.stop()
15051499
self.del_test_dir(module_name, self.fname)
15061500

15071501
def test_dry_run_catchup_ptrack(self):
15081502
"""
15091503
Test dry-run option for catchup in incremental ptrack mode
15101504
"""
1511-
if not self.ptrack:
1512-
return unittest.skip('Skipped because ptrack support is disabled')
1513-
1514-
# preparation 1: source
1505+
# preparation 1: source
15151506
src_pg = self.make_simple_node(
15161507
base_dir = os.path.join(module_name, self.fname, 'src'),
15171508
set_replication = True,
1518-
pg_options = { 'wal_log_hints': 'on' }
1509+
ptrack_enable = True,
1510+
initdb_params = ['--data-checksums']
15191511
)
15201512
src_pg.slow_start()
1521-
src_pg.safe_psql(
1522-
"postgres",
1523-
"CREATE TABLE ultimate_question(answer int)")
1513+
src_pg.safe_psql("postgres", "CREATE EXTENSION ptrack")
1514+
15241515
src_pg.pgbench_init(scale = 10)
15251516
pgbench = src_pg.pgbench(options=['-T', '10', '--no-vacuum'])
15261517
pgbench.wait()
1527-
src_pg.safe_psql("postgres", "INSERT INTO ultimate_question VALUES(42)")
15281518

15291519
# preparation 2: make clean shutdowned lagging behind replica
15301520
dst_pg = self.make_empty_node(os.path.join(module_name, self.fname, 'dst'))
@@ -1560,7 +1550,6 @@ def test_dry_run_catchup_ptrack(self):
15601550

15611551
# Cleanup
15621552
src_pg.stop()
1563-
dst_pg.stop()
15641553
self.del_test_dir(module_name, self.fname)
15651554

15661555
def test_dry_run_catchup_delta(self):
@@ -1572,18 +1561,16 @@ def test_dry_run_catchup_delta(self):
15721561
src_pg = self.make_simple_node(
15731562
base_dir = os.path.join(module_name, self.fname, 'src'),
15741563
set_replication = True,
1564+
initdb_params = ['--data-checksums'],
15751565
pg_options = { 'wal_log_hints': 'on' }
15761566
)
15771567
src_pg.slow_start()
1578-
src_pg.safe_psql(
1579-
"postgres",
1580-
"CREATE TABLE ultimate_question(answer int)")
1568+
15811569
src_pg.pgbench_init(scale = 10)
15821570
pgbench = src_pg.pgbench(options=['-T', '10', '--no-vacuum'])
15831571
pgbench.wait()
1584-
src_pg.safe_psql("postgres", "INSERT INTO ultimate_question VALUES(42)")
15851572

1586-
# preparation 2: make clean shutdowned lagging behind replica
1573+
# preparation 2: make clean shutdowned lagging behind replica
15871574
dst_pg = self.make_empty_node(os.path.join(module_name, self.fname, 'dst'))
15881575
self.catchup_node(
15891576
backup_mode = 'FULL',
@@ -1601,12 +1588,12 @@ def test_dry_run_catchup_delta(self):
16011588
# save the condition before dry-run
16021589
content_before = self.pgdata_content(dst_pg.data_dir)
16031590

1604-
# do incremental catchup
1591+
# do delta catchup
16051592
self.catchup_node(
16061593
backup_mode = 'DELTA',
16071594
source_pgdata = src_pg.data_dir,
16081595
destination_node = dst_pg,
1609-
options = ['-d', 'postgres', '-p', str(src_pg.port), '--stream', '--dry-run']
1596+
options = ['-d', 'postgres', '-p', str(src_pg.port), '--stream', "--dry-run"]
16101597
)
16111598

16121599
# compare data dirs before and after cathup
@@ -1617,6 +1604,5 @@ def test_dry_run_catchup_delta(self):
16171604

16181605
# Cleanup
16191606
src_pg.stop()
1620-
dst_pg.stop()
16211607
self.del_test_dir(module_name, self.fname)
16221608

0 commit comments

Comments
 (0)