mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-02-09 14:33:17 +02:00
tests: changes to tests.README and minor corrections
This commit is contained in:
parent
e1e628110c
commit
9e44d505bc
@ -15,6 +15,7 @@ Check archive compression:
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
pip install testgres==0.4.0
|
pip install testgres==0.4.0
|
||||||
|
pip install psycopg2
|
||||||
export PG_CONFIG=/path/to/pg_config
|
export PG_CONFIG=/path/to/pg_config
|
||||||
python -m unittest [-v] tests[.specific_module][.class.test]
|
python -m unittest [-v] tests[.specific_module][.class.test]
|
||||||
```
|
```
|
||||||
|
@ -403,7 +403,13 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"WARNING: File" in e.message and
|
"WARNING: File" in e.message and
|
||||||
"blknum" in e.message and
|
"blknum" in e.message and
|
||||||
"have wrong checksum" in e.message,
|
"have wrong checksum" in e.message and
|
||||||
|
"try to fetch via SQL" in e.message and
|
||||||
|
"WARNING: page verification failed, "
|
||||||
|
"calculated checksum" in e.message and
|
||||||
|
"ERROR: query failed: "
|
||||||
|
"ERROR: invalid page in block" in e.message and
|
||||||
|
"query was: SELECT pg_ptrack_get_block_2" 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))
|
||||||
|
|
||||||
|
@ -13,10 +13,14 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
|||||||
def test_ptrack_clean(self):
|
def test_ptrack_clean(self):
|
||||||
"""Take backups of every available types and check that PTRACK is clean"""
|
"""Take backups of every available types and check that PTRACK is clean"""
|
||||||
fname = self.id().split('.')[3]
|
fname = self.id().split('.')[3]
|
||||||
node = self.make_simple_node(base_dir="{0}/{1}/node".format(module_name, fname),
|
node = self.make_simple_node(
|
||||||
|
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={'ptrack_enable': 'on', 'wal_level': 'replica', 'max_wal_senders': '2'})
|
pg_options={
|
||||||
|
'ptrack_enable': 'on',
|
||||||
|
'wal_level': 'replica',
|
||||||
|
'max_wal_senders': '2'})
|
||||||
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)
|
||||||
self.add_instance(backup_dir, 'node', node)
|
self.add_instance(backup_dir, 'node', node)
|
||||||
@ -53,7 +57,9 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
|
|||||||
node.safe_psql('postgres', 'vacuum t_heap')
|
node.safe_psql('postgres', 'vacuum t_heap')
|
||||||
|
|
||||||
# Take PTRACK backup to clean every ptrack
|
# Take PTRACK backup to clean every ptrack
|
||||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='ptrack', options=['-j100'])
|
backup_id = self.backup_node(
|
||||||
|
backup_dir, 'node', node, backup_type='ptrack',
|
||||||
|
options=['-j100', '--log-level-file=verbose'])
|
||||||
node.safe_psql('postgres', 'checkpoint')
|
node.safe_psql('postgres', 'checkpoint')
|
||||||
|
|
||||||
for i in idx_ptrack:
|
for i in idx_ptrack:
|
||||||
|
@ -967,7 +967,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
|||||||
# Delete wal segment
|
# Delete wal segment
|
||||||
wals_dir = os.path.join(backup_dir, 'wal', 'node')
|
wals_dir = os.path.join(backup_dir, 'wal', 'node')
|
||||||
wals = [f for f in os.listdir(wals_dir) if os.path.isfile(os.path.join(wals_dir, f)) and not f.endswith('.backup')]
|
wals = [f for f in os.listdir(wals_dir) if os.path.isfile(os.path.join(wals_dir, f)) and not f.endswith('.backup')]
|
||||||
file = os.path.join(backup_dir, 'wal', 'node', wals[1])
|
wals.sort()
|
||||||
|
file = os.path.join(backup_dir, 'wal', 'node', wals[3])
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
|
|
||||||
# cut out '.gz'
|
# cut out '.gz'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user