mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2026-06-21 01:34:15 +02:00
tests: fixes for Windows
This commit is contained in:
+3
-4
@@ -148,9 +148,9 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
|
|||||||
|
|
||||||
# full backup mode
|
# full backup mode
|
||||||
self.backup_node(backup_dir, 'node', node)
|
self.backup_node(backup_dir, 'node', node)
|
||||||
# page backup mode
|
# ptrack backup mode
|
||||||
self.backup_node(backup_dir, 'node', node, backup_type="ptrack")
|
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")
|
self.backup_node(backup_dir, 'node', node, backup_type="ptrack")
|
||||||
# full backup mode
|
# full backup mode
|
||||||
self.backup_node(backup_dir, 'node', node)
|
self.backup_node(backup_dir, 'node', node)
|
||||||
@@ -249,8 +249,7 @@ class DeleteTest(ProbackupTest, unittest.TestCase):
|
|||||||
node = self.make_simple_node(
|
node = self.make_simple_node(
|
||||||
base_dir=os.path.join(module_name, fname, 'node'),
|
base_dir=os.path.join(module_name, fname, 'node'),
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
set_replication=True,
|
set_replication=True)
|
||||||
pg_options={'ptrack_enable': 'on'})
|
|
||||||
|
|
||||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||||
self.init_pb(backup_dir)
|
self.init_pb(backup_dir)
|
||||||
|
|||||||
+11
-5
@@ -1268,7 +1268,9 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
|||||||
backup_dir, 'node', node)
|
backup_dir, 'node', node)
|
||||||
|
|
||||||
# Nullify some block in PostgreSQL
|
# 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:
|
with open(file, 'r+b', 0) as f:
|
||||||
f.seek(8192)
|
f.seek(8192)
|
||||||
@@ -1286,10 +1288,14 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
|||||||
if not self.remote:
|
if not self.remote:
|
||||||
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
|
log_file_path = os.path.join(backup_dir, "log", "pg_probackup.log")
|
||||||
with open(log_file_path) as f:
|
with open(log_file_path) as f:
|
||||||
self.assertTrue("LOG: File: {0} blknum 1, empty page".format(
|
content = f.read()
|
||||||
file) in f.read())
|
|
||||||
self.assertFalse("Skipping blknum: 1 in file: {0}".format(
|
self.assertIn(
|
||||||
file) in f.read())
|
"LOG: File: {0} blknum 1, empty page".format(file),
|
||||||
|
content)
|
||||||
|
self.assertNotIn(
|
||||||
|
"Skipping blknum: 1 in file: {0}".format(file),
|
||||||
|
content)
|
||||||
|
|
||||||
# Restore DELTA backup
|
# Restore DELTA backup
|
||||||
node_restored = self.make_simple_node(
|
node_restored = self.make_simple_node(
|
||||||
|
|||||||
@@ -485,7 +485,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
base_dir=os.path.join(module_name, fname, 'node'),
|
base_dir=os.path.join(module_name, fname, 'node'),
|
||||||
set_replication=True, initdb_params=['--data-checksums'],
|
set_replication=True, initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -564,7 +563,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
base_dir=os.path.join(module_name, fname, 'node'),
|
base_dir=os.path.join(module_name, fname, 'node'),
|
||||||
set_replication=True, initdb_params=['--data-checksums'],
|
set_replication=True, initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -648,7 +646,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'checkpoint_timeout': '300s',
|
'checkpoint_timeout': '300s',
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
@@ -742,7 +739,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'checkpoint_timeout': '300s',
|
'checkpoint_timeout': '300s',
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
@@ -836,7 +832,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'checkpoint_timeout': '300s',
|
'checkpoint_timeout': '300s',
|
||||||
'autovacuum': 'off',
|
'autovacuum': 'off',
|
||||||
'ptrack_enable': 'on'
|
'ptrack_enable': 'on'
|
||||||
@@ -930,7 +925,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
base_dir=os.path.join(module_name, fname, 'node'),
|
base_dir=os.path.join(module_name, fname, 'node'),
|
||||||
set_replication=True, initdb_params=['--data-checksums'],
|
set_replication=True, initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'checkpoint_timeout': '30s',
|
'checkpoint_timeout': '30s',
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
@@ -1683,7 +1677,6 @@ class MergeTest(ProbackupTest, unittest.TestCase):
|
|||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'autovacuum': 'off'})
|
'autovacuum': 'off'})
|
||||||
|
|
||||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||||
|
|||||||
+4
-5
@@ -911,7 +911,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
"create table t_heap_alien as select i as id, "
|
"create table t_heap_alien as select i as id, "
|
||||||
"md5(i::text) as text, "
|
"md5(i::text) as text, "
|
||||||
"md5(repeat(i::text,10))::tsvector as tsvector "
|
"md5(repeat(i::text,10))::tsvector as tsvector "
|
||||||
"from generate_series(0,1000) i;")
|
"from generate_series(0,100000) i;")
|
||||||
|
|
||||||
# copy lastest wal segment
|
# copy lastest wal segment
|
||||||
wals_dir = os.path.join(backup_dir, 'wal', 'alien_node')
|
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')
|
# file = os.path.join(wals_dir, '000000010000000000000004')
|
||||||
print(file)
|
print(file)
|
||||||
print(file_destination)
|
print(file_destination)
|
||||||
|
os.remove(file_destination)
|
||||||
os.rename(file, file_destination)
|
os.rename(file, file_destination)
|
||||||
|
|
||||||
# Single-thread PAGE backup
|
# Single-thread PAGE backup
|
||||||
@@ -944,8 +945,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
'Could not read WAL record at' in e.message and
|
'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
|
'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
|
'pg_control database system identifier is' in e.message and
|
||||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
'Possible WAL corruption. Error has occured during reading WAL segment' in e.message,
|
||||||
file_destination) in e.message,
|
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(e.message), self.cmd))
|
repr(e.message), self.cmd))
|
||||||
|
|
||||||
@@ -971,8 +971,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
'Could not read WAL record at' in e.message and
|
'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
|
'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
|
'pg_control database system identifier is' in e.message and
|
||||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
'Possible WAL corruption. Error has occured during reading WAL segment' in e.message,
|
||||||
file_destination) in e.message,
|
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(e.message), self.cmd))
|
repr(e.message), self.cmd))
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -762,7 +762,8 @@ class RetentionTest(ProbackupTest, unittest.TestCase):
|
|||||||
fname = self.id().split('.')[3]
|
fname = self.id().split('.')[3]
|
||||||
node = self.make_simple_node(
|
node = self.make_simple_node(
|
||||||
base_dir=os.path.join(module_name, fname, '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')
|
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||||
self.init_pb(backup_dir)
|
self.init_pb(backup_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user