Skip to content

Commit 7972cf7

Browse files
committedNov 19, 2021
Fixes if tests/archive.py for passing tests on Windows
1 parent 4194d7e commit 7972cf7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

Diff for: ‎tests/archive.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1845,8 +1845,15 @@ def test_undefined_wal_file_path(self):
18451845
self.init_pb(backup_dir)
18461846
self.add_instance(backup_dir, 'node', node)
18471847
self.set_archiving(backup_dir, 'node', node)
1848-
archive_command = '\"{0}\" archive-push -B \"{1}\" --instance \"{2}\" --wal-file-name=%f'.format(
1849-
self.probackup_path, backup_dir, 'node')
1848+
if os.name == 'posix':
1849+
archive_command = '\"{0}\" archive-push -B \"{1}\" --instance \"{2}\" --wal-file-name=%f'.format(
1850+
self.probackup_path, backup_dir, 'node')
1851+
elif os.name == 'nt':
1852+
archive_command = '\"{0}\" archive-push -B \"{1}\" --instance \"{2}\" --wal-file-name=%f'.format(
1853+
self.probackup_path, backup_dir, 'node').replace("\\","\\\\")
1854+
else:
1855+
self.assertTrue(False, 'Unexpected os family')
1856+
18501857
self.set_auto_conf(
18511858
node,
18521859
{'archive_command': archive_command})
@@ -1892,7 +1899,7 @@ def test_intermediate_archiving(self):
18921899
if os.name == 'posix':
18931900
self.set_archiving(backup_dir, 'node', node, custom_archive_command='cp -v %p {0}/%f'.format(wal_dir))
18941901
elif os.name == 'nt':
1895-
self.set_archiving(backup_dir, 'node', node, custom_archive_command='xcopy /F "%p" "{0}\\%f"'.format(wal_dir.replace("\\","\\\\")))
1902+
self.set_archiving(backup_dir, 'node', node, custom_archive_command='copy /Y "%p" "{0}\\\\%f"'.format(wal_dir.replace("\\","\\\\")))
18961903
else:
18971904
self.assertTrue(False, 'Unexpected os family')
18981905

0 commit comments

Comments
 (0)
Please sign in to comment.