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

Skip to content

Commit dd2d85d

Browse files
committed
tests: added truncate_every_file_in_dir
1 parent e66d96a commit dd2d85d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/helpers/ptrack_helpers.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,12 @@ def get_backup_filelist_diff(self, filelist_A, filelist_B):
584584

585585
return filelist_diff
586586

587+
# used for partial restore
588+
def truncate_every_file_in_dir(self, path):
589+
for file in os.listdir(path):
590+
with open(os.path.join(path, file), "w") as f:
591+
f.close()
592+
587593
def check_ptrack_recovery(self, idx_dict):
588594
size = idx_dict['size']
589595
for PageNum in range(size):
@@ -734,20 +740,24 @@ def clean_pb(self, backup_dir):
734740

735741
def backup_node(
736742
self, backup_dir, instance, node, data_dir=False,
737-
backup_type='full', options=[], asynchronous=False, gdb=False,
743+
backup_type='full', datname=False, options=[],
744+
asynchronous=False, gdb=False,
738745
old_binary=False, return_id=True
739746
):
740747
if not node and not data_dir:
741748
print('You must provide ether node or data_dir for backup')
742749
exit(1)
743750

751+
if not datname:
752+
datname = 'postgres'
753+
744754
cmd_list = [
745755
'backup',
746756
'-B', backup_dir,
747757
'--instance={0}'.format(instance),
748758
# "-D", pgdata,
749759
'-p', '%i' % node.port,
750-
'-d', 'postgres'
760+
'-d', datname
751761
]
752762

753763
if data_dir:

0 commit comments

Comments
 (0)