1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-03-06 16:16:33 +02:00

Fix test test_arhive_push_file_exists

This commit is contained in:
Sergey Cherkashin 2018-10-18 15:05:51 +03:00
parent 20d4dcc291
commit 6d0cbfa232
2 changed files with 5 additions and 7 deletions

View File

@ -1124,7 +1124,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
return;
/* Do not copy and do not rise error. Just quit as normal. */
else if (!overwrite)
elog(ERROR, "WAL segment \"%s\" already exists.", to_path);
elog(ERROR, "WAL segment \"%s\" already exists.", to_path_p);
}
/* open backup file for write */

View File

@ -1,6 +1,6 @@
import os
import shutil
import zlib
import gzip
import unittest
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, archive_script
from datetime import datetime, timedelta
@ -329,13 +329,11 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
wal_src = os.path.join(node.data_dir, 'pg_wal', '000000010000000000000001')
if self.archive_compress:
with open(wal_src, 'rb') as f_in, open(file, 'wb') as f_out:
original_wal = f_in.read()
compressed_wal = zlib.compress(original_wal, 1)
f_out.write(compressed_wal)
with open(wal_src, 'rb') as f_in, gzip.open(file, 'wb', compresslevel=1) as f_out:
shutil.copyfileobj(f_in, f_out)
else:
shutil.copyfile(wal_src, file)
self.switch_wal_segment(node)
sleep(5)