1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-04-15 12:16:41 +02:00

tests: fix test_validate_nullified_heap_page_backup and test_delta_nullified_heap_page_backup

This commit is contained in:
Grigory Smolkin 2019-03-18 12:04:18 +03:00
parent 46da0d851f
commit a23386e17a
2 changed files with 26 additions and 18 deletions

View File

@ -1254,9 +1254,8 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
fname = self.id().split('.')[3]
node = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node'),
initdb_params=['--data-checksums'],
pg_options={'wal_level': 'replica'}
)
initdb_params=['--data-checksums'])
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
@ -1292,6 +1291,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
if self.paranoia:
pgdata = self.pgdata_content(node.data_dir)
if not self.remote:
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
with open(log_file_path) as f:
self.assertTrue("LOG: File: {0} blknum 1, empty page".format(
@ -1301,13 +1301,11 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
# Restore DELTA backup
node_restored = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node_restored'),
)
base_dir=os.path.join(module_name, fname, 'node_restored'))
node_restored.cleanup()
self.restore_node(
backup_dir, 'node', node_restored
)
backup_dir, 'node', node_restored)
if self.paranoia:
pgdata_restored = self.pgdata_content(node_restored.data_dir)

View File

@ -51,14 +51,24 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
self.backup_node(
backup_dir, 'node', node, options=['--log-level-file=verbose'])
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
if self.paranoia:
pgdata = self.pgdata_content(node.data_dir)
if not self.remote:
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
with open(log_file_path) as f:
self.assertTrue(
'{0} blknum 1, empty page'.format(file_path) in f.read(),
'Failed to detect nullified block')
self.validate_pb(backup_dir)
node.cleanup()
self.restore_node(backup_dir, 'node', node)
if self.paranoia:
pgdata_restored = self.pgdata_content(node.data_dir)
self.compare_pgdata(pgdata, pgdata_restored)
# Clean after yourself
self.del_test_dir(module_name, fname)