1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-02-03 14:01:57 +02:00

tests: changes to tests.README and minor corrections

This commit is contained in:
Grigory Smolkin 2018-01-18 17:15:15 +03:00
parent e1e628110c
commit 9e44d505bc
4 changed files with 19 additions and 5 deletions

View File

@ -15,6 +15,7 @@ Check archive compression:
Usage:
pip install testgres==0.4.0
pip install psycopg2
export PG_CONFIG=/path/to/pg_config
python -m unittest [-v] tests[.specific_module][.class.test]
```

View File

@ -403,7 +403,13 @@ class BackupTest(ProbackupTest, unittest.TestCase):
self.assertTrue(
"WARNING: File" 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(
repr(e.message), self.cmd))

View File

@ -13,10 +13,14 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
def test_ptrack_clean(self):
"""Take backups of every available types and check that PTRACK is clean"""
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,
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')
self.init_pb(backup_dir)
self.add_instance(backup_dir, 'node', node)
@ -53,7 +57,9 @@ class SimpleTest(ProbackupTest, unittest.TestCase):
node.safe_psql('postgres', 'vacuum t_heap')
# 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')
for i in idx_ptrack:

View File

@ -967,7 +967,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
# Delete wal segment
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')]
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)
# cut out '.gz'