From 9e44d505bcba4191670638f10cbe9d18a0f32b6a Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Thu, 18 Jan 2018 17:15:15 +0300 Subject: [PATCH] tests: changes to tests.README and minor corrections --- tests/Readme.md | 1 + tests/backup_test.py | 8 +++++++- tests/ptrack_clean.py | 12 +++++++++--- tests/validate_test.py | 3 ++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/Readme.md b/tests/Readme.md index 63eefd7d..e7f8cb70 100644 --- a/tests/Readme.md +++ b/tests/Readme.md @@ -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] ``` diff --git a/tests/backup_test.py b/tests/backup_test.py index 5a66c6db..fb9df171 100644 --- a/tests/backup_test.py +++ b/tests/backup_test.py @@ -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)) diff --git a/tests/ptrack_clean.py b/tests/ptrack_clean.py index 51b5e044..72d4c2a3 100644 --- a/tests/ptrack_clean.py +++ b/tests/ptrack_clean.py @@ -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: diff --git a/tests/validate_test.py b/tests/validate_test.py index 3a4984c6..121393d0 100644 --- a/tests/validate_test.py +++ b/tests/validate_test.py @@ -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'