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

Skip to content

Commit 091b7c6

Browse files
committed
tests: minor fixes for Windows
1 parent a712882 commit 091b7c6

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

tests/archive.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,11 @@ def test_arhive_push_file_exists(self):
296296

297297
wals_dir = os.path.join(backup_dir, 'wal', 'node')
298298
if self.archive_compress:
299-
file = os.path.join(wals_dir, '000000010000000000000001.gz')
299+
filename = '000000010000000000000001.gz'
300+
file = os.path.join(wals_dir, filename)
300301
else:
301-
file = os.path.join(wals_dir, '000000010000000000000001')
302+
filename = '000000010000000000000001'
303+
file = os.path.join(wals_dir, filename)
302304

303305
with open(file, 'a') as f:
304306
f.write(b"blablablaadssaaaaaaaaaaaaaaa")
@@ -319,7 +321,8 @@ def test_arhive_push_file_exists(self):
319321
'LOG: archive command failed with exit code 1' in log_content and
320322
'DETAIL: The failed archive command was:' in log_content and
321323
'INFO: pg_probackup archive-push from' in log_content and
322-
'ERROR: WAL segment "{0}" already exists.'.format(file) in log_content,
324+
'ERROR: WAL segment ' in log_content and
325+
'{0}" already exists.'.format(filename) in log_content,
323326
'Expecting error messages about failed archive_command'
324327
)
325328
self.assertFalse('pg_probackup archive-push completed successfully' in log_content)
@@ -369,9 +372,11 @@ def test_arhive_push_file_exists_overwrite(self):
369372

370373
wals_dir = os.path.join(backup_dir, 'wal', 'node')
371374
if self.archive_compress:
372-
file = os.path.join(wals_dir, '000000010000000000000001.gz')
375+
filename = '000000010000000000000001.gz'
376+
file = os.path.join(wals_dir, filename)
373377
else:
374-
file = os.path.join(wals_dir, '000000010000000000000001')
378+
filename = '000000010000000000000001'
379+
file = os.path.join(wals_dir, filename)
375380

376381
with open(file, 'a') as f:
377382
f.write(b"blablablaadssaaaaaaaaaaaaaaa")
@@ -392,7 +397,7 @@ def test_arhive_push_file_exists_overwrite(self):
392397
'LOG: archive command failed with exit code 1' in log_content and
393398
'DETAIL: The failed archive command was:' in log_content and
394399
'INFO: pg_probackup archive-push from' in log_content and
395-
'ERROR: WAL segment "{0}" already exists.'.format(file) in log_content,
400+
'{0}" already exists.'.format(filename) in log_content,
396401
'Expecting error messages about failed archive_command'
397402
)
398403
self.assertFalse('pg_probackup archive-push completed successfully' in log_content)

tests/backup_test.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,17 @@ def test_tablespace_handling(self):
610610
"drop tablespace some_lame_tablespace")
611611

612612
self.backup_node(
613-
backup_dir, 'node', node, backup_type="delta",
614-
options=["-j", "4", "--stream"])
613+
backup_dir, 'node', node, backup_type="delta",
614+
options=["-j", "4", "--stream"])
615615

616616
self.restore_node(
617-
backup_dir, 'node', node_restored,
618-
options=[
619-
"-j", "4",
620-
"-T", "{0}={1}".format(
621-
tblspace1_old_path, tblspace1_new_path),
622-
"-T", "{0}={1}".format(
623-
tblspace2_old_path, tblspace2_new_path)])
617+
backup_dir, 'node', node_restored,
618+
options=[
619+
"-j", "4",
620+
"-T", "{0}={1}".format(
621+
tblspace1_old_path, tblspace1_new_path),
622+
"-T", "{0}={1}".format(
623+
tblspace2_old_path, tblspace2_new_path)])
624624

625625
if self.paranoia:
626626
pgdata = self.pgdata_content(node.data_dir)

0 commit comments

Comments
 (0)