Skip to content

Commit a23386e

Browse files
committed
tests: fix test_validate_nullified_heap_page_backup and test_delta_nullified_heap_page_backup
1 parent 46da0d8 commit a23386e

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

tests/delta.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,9 +1254,8 @@ def test_delta_nullified_heap_page_backup(self):
12541254
fname = self.id().split('.')[3]
12551255
node = self.make_simple_node(
12561256
base_dir=os.path.join(module_name, fname, 'node'),
1257-
initdb_params=['--data-checksums'],
1258-
pg_options={'wal_level': 'replica'}
1259-
)
1257+
initdb_params=['--data-checksums'])
1258+
12601259
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
12611260
self.init_pb(backup_dir)
12621261
self.add_instance(backup_dir, 'node', node)
@@ -1292,22 +1291,21 @@ def test_delta_nullified_heap_page_backup(self):
12921291
if self.paranoia:
12931292
pgdata = self.pgdata_content(node.data_dir)
12941293

1295-
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
1296-
with open(log_file_path) as f:
1297-
self.assertTrue("LOG: File: {0} blknum 1, empty page".format(
1298-
file) in f.read())
1299-
self.assertFalse("Skipping blknum: 1 in file: {0}".format(
1300-
file) in f.read())
1294+
if not self.remote:
1295+
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
1296+
with open(log_file_path) as f:
1297+
self.assertTrue("LOG: File: {0} blknum 1, empty page".format(
1298+
file) in f.read())
1299+
self.assertFalse("Skipping blknum: 1 in file: {0}".format(
1300+
file) in f.read())
13011301

13021302
# Restore DELTA backup
13031303
node_restored = self.make_simple_node(
1304-
base_dir=os.path.join(module_name, fname, 'node_restored'),
1305-
)
1304+
base_dir=os.path.join(module_name, fname, 'node_restored'))
13061305
node_restored.cleanup()
13071306

13081307
self.restore_node(
1309-
backup_dir, 'node', node_restored
1310-
)
1308+
backup_dir, 'node', node_restored)
13111309

13121310
if self.paranoia:
13131311
pgdata_restored = self.pgdata_content(node_restored.data_dir)

tests/validate_test.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,24 @@ def test_validate_nullified_heap_page_backup(self):
5151
self.backup_node(
5252
backup_dir, 'node', node, options=['--log-level-file=verbose'])
5353

54-
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
54+
if self.paranoia:
55+
pgdata = self.pgdata_content(node.data_dir)
5556

56-
with open(log_file_path) as f:
57-
self.assertTrue(
58-
'{0} blknum 1, empty page'.format(file_path) in f.read(),
59-
'Failed to detect nullified block')
57+
if not self.remote:
58+
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
59+
with open(log_file_path) as f:
60+
self.assertTrue(
61+
'{0} blknum 1, empty page'.format(file_path) in f.read(),
62+
'Failed to detect nullified block')
6063

6164
self.validate_pb(backup_dir)
65+
node.cleanup()
66+
67+
self.restore_node(backup_dir, 'node', node)
68+
69+
if self.paranoia:
70+
pgdata_restored = self.pgdata_content(node.data_dir)
71+
self.compare_pgdata(pgdata, pgdata_restored)
6272

6373
# Clean after yourself
6474
self.del_test_dir(module_name, fname)

0 commit comments

Comments
 (0)