Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a64e56

Browse files
committed
tests: added validate.ValidateTest.test_validation_after_backup
1 parent c3c05e8 commit 6a64e56

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/validate.py

+38
Original file line numberDiff line numberDiff line change
@@ -3365,6 +3365,44 @@ def test_corrupt_pg_control_via_resetxlog(self):
33653365
# Clean after yourself
33663366
self.del_test_dir(module_name, fname)
33673367

3368+
# @unittest.skip("skip")
3369+
def test_validation_after_backup(self):
3370+
""""""
3371+
fname = self.id().split('.')[3]
3372+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
3373+
node = self.make_simple_node(
3374+
base_dir=os.path.join(module_name, fname, 'node'),
3375+
set_replication=True,
3376+
initdb_params=['--data-checksums'])
3377+
3378+
self.init_pb(backup_dir)
3379+
self.add_instance(backup_dir, 'node', node)
3380+
node.slow_start()
3381+
3382+
# FULL backup
3383+
gdb = self.backup_node(
3384+
backup_dir, 'node', node, gdb=True, options=['--stream'])
3385+
3386+
gdb.set_breakpoint('pgBackupValidate')
3387+
gdb.run_until_break()
3388+
3389+
backup_id = self.show_pb(backup_dir, 'node')[0]['id']
3390+
3391+
file = os.path.join(
3392+
backup_dir, "backups", "node", backup_id,
3393+
"database", "postgresql.conf")
3394+
os.remove(file)
3395+
3396+
gdb.continue_execution_until_exit()
3397+
3398+
self.assertEqual(
3399+
'CORRUPT',
3400+
self.show_pb(backup_dir, 'node', backup_id)['status'],
3401+
'Backup STATUS should be "ERROR"')
3402+
3403+
# Clean after yourself
3404+
self.del_test_dir(module_name, fname)
3405+
33683406
# validate empty backup list
33693407
# page from future during validate
33703408
# page from future during backup

0 commit comments

Comments
 (0)