1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-24 08:52:38 +02:00

tests: fixes for Windows

This commit is contained in:
Grigory Smolkin 2019-04-30 20:18:40 +03:00
parent e771c97aa2
commit b7a9a20b99
5 changed files with 20 additions and 22 deletions

View File

@ -148,9 +148,9 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
# full backup mode
self.backup_node(backup_dir, 'node', node)
# page backup mode
# ptrack backup mode
self.backup_node(backup_dir, 'node', node, backup_type="ptrack")
# page backup mode
# ptrack backup mode
self.backup_node(backup_dir, 'node', node, backup_type="ptrack")
# full backup mode
self.backup_node(backup_dir, 'node', node)
@ -249,8 +249,7 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
node = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node'),
initdb_params=['--data-checksums'],
set_replication=True,
pg_options={'ptrack_enable': 'on'})
set_replication=True)
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
self.init_pb(backup_dir)

View File

@ -1268,7 +1268,9 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
backup_dir, 'node', node)
# Nullify some block in PostgreSQL
file = os.path.join(node.data_dir, file_path)
file = os.path.join(node.data_dir, file_path).replace("\\","/")
if os.name == 'nt':
file = file.replace("\\","/")
with open(file, 'r+b', 0) as f:
f.seek(8192)
@ -1286,10 +1288,14 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
if not self.remote:
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
with open(log_file_path) as f:
self.assertTrue("LOG: File: {0} blknum 1, empty page".format(
file) in f.read())
self.assertFalse("Skipping blknum: 1 in file: {0}".format(
file) in f.read())
content = f.read()
self.assertIn(
"LOG: File: {0} blknum 1, empty page".format(file),
content)
self.assertNotIn(
"Skipping blknum: 1 in file: {0}".format(file),
content)
# Restore DELTA backup
node_restored = self.make_simple_node(

View File

@ -485,7 +485,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
base_dir=os.path.join(module_name, fname, 'node'),
set_replication=True, initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'autovacuum': 'off'
}
)
@ -564,7 +563,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
base_dir=os.path.join(module_name, fname, 'node'),
set_replication=True, initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'autovacuum': 'off'
}
)
@ -648,7 +646,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
set_replication=True,
initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'checkpoint_timeout': '300s',
'autovacuum': 'off'
}
@ -742,7 +739,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
set_replication=True,
initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'checkpoint_timeout': '300s',
'autovacuum': 'off'
}
@ -836,7 +832,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
set_replication=True,
initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'checkpoint_timeout': '300s',
'autovacuum': 'off',
'ptrack_enable': 'on'
@ -930,7 +925,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
base_dir=os.path.join(module_name, fname, 'node'),
set_replication=True, initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'checkpoint_timeout': '30s',
'autovacuum': 'off'
}
@ -1683,7 +1677,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
set_replication=True,
initdb_params=['--data-checksums'],
pg_options={
'max_wal_senders': '2',
'autovacuum': 'off'})
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')

View File

@ -911,7 +911,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
"create table t_heap_alien as select i as id, "
"md5(i::text) as text, "
"md5(repeat(i::text,10))::tsvector as tsvector "
"from generate_series(0,1000) i;")
"from generate_series(0,100000) i;")
# copy lastest wal segment
wals_dir = os.path.join(backup_dir, 'wal', 'alien_node')
@ -925,6 +925,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
# file = os.path.join(wals_dir, '000000010000000000000004')
print(file)
print(file_destination)
os.remove(file_destination)
os.rename(file, file_destination)
# Single-thread PAGE backup
@ -944,8 +945,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
'Could not read WAL record at' in e.message and
'WAL file is from different database system: WAL file database system identifier is' in e.message and
'pg_control database system identifier is' in e.message and
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
file_destination) in e.message,
'Possible WAL corruption. Error has occured during reading WAL segment' in e.message,
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
repr(e.message), self.cmd))
@ -971,8 +971,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
'Could not read WAL record at' in e.message and
'WAL file is from different database system: WAL file database system identifier is' in e.message and
'pg_control database system identifier is' in e.message and
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
file_destination) in e.message,
'Possible WAL corruption. Error has occured during reading WAL segment' in e.message,
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
repr(e.message), self.cmd))

View File

@ -762,7 +762,8 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
fname = self.id().split('.')[3]
node = self.make_simple_node(
base_dir=os.path.join(module_name, fname, 'node'),
initdb_params=['--data-checksums'])
initdb_params=['--data-checksums'],
pg_options={'autovacuum': 'off'})
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
self.init_pb(backup_dir)