From 052329fc85fa092f93934a2cc570c1a8b1c7a13c Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Mon, 26 Feb 2018 18:34:56 +0300 Subject: [PATCH] tests: disable autovacuum in pgdata_compare() tests --- tests/backup_test.py | 4 ++-- tests/page.py | 30 ++++++++++++++++++++++++------ tests/ptrack.py | 3 ++- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/tests/backup_test.py b/tests/backup_test.py index ab9292ac..d0209534 100644 --- a/tests/backup_test.py +++ b/tests/backup_test.py @@ -292,7 +292,7 @@ class BackupTest(ProbackupTest, unittest.TestCase): self.del_test_dir(module_name, fname) # @unittest.skip("skip") - def test_checksumm_fail_heal_via_ptrack(self): + def test_page_corruption_heal_via_ptrack_1(self): """make node, corrupt some page, check that backup failed""" fname = self.id().split('.')[3] node = self.make_simple_node( @@ -349,7 +349,7 @@ class BackupTest(ProbackupTest, unittest.TestCase): self.del_test_dir(module_name, fname) # @unittest.skip("skip") - def test_checksumm_fail_heal_via_ptrack_fail(self): + def test_page_corruption_heal_via_ptrack_2(self): """make node, corrupt some page, check that backup failed""" fname = self.id().split('.')[3] node = self.make_simple_node( diff --git a/tests/page.py b/tests/page.py index c54453a6..bafc7025 100644 --- a/tests/page.py +++ b/tests/page.py @@ -26,7 +26,8 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): pg_options={ 'wal_level': 'replica', 'max_wal_senders': '2', - 'checkpoint_timeout': '300s' + 'checkpoint_timeout': '300s', + 'autovacuum': 'off' } ) node_restored = self.make_simple_node( @@ -70,8 +71,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): ) self.backup_node( - backup_dir, 'node', node, backup_type='page', - options=['--log-level-file=verbose'] + backup_dir, 'node', node, backup_type='page' ) if self.paranoia: @@ -95,6 +95,21 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): "postgresql.auto.conf", "port = {0}".format(node_restored.port)) node_restored.start() + while node_restored.safe_psql( + "postgres", "select pg_is_in_recovery()") == 't\n': + time.sleep(1) + + # Logical comparison + result1 = node.safe_psql( + "postgres", + "select * from t_heap" + ) + result2 = node_restored.safe_psql( + "postgres", + "select * from t_heap" + ) + self.assertEqual(result1, result2) + # Clean after yourself self.del_test_dir(module_name, fname) @@ -280,12 +295,15 @@ class PageBackupTest(ProbackupTest, unittest.TestCase): pgdata_restored = self.pgdata_content(restored_node.data_dir) # START RESTORED NODE - restored_node.append_conf("postgresql.auto.conf", "port = {0}".format(restored_node.port)) + restored_node.append_conf( + "postgresql.auto.conf", "port = {0}".format(restored_node.port)) restored_node.start() - while restored_node.safe_psql("postgres", "select pg_is_in_recovery()") == 't\n': + while restored_node.safe_psql( + "postgres", "select pg_is_in_recovery()") == 't\n': time.sleep(1) - result_new = restored_node.safe_psql("postgres", "select * from pgbench_accounts") + result_new = restored_node.safe_psql( + "postgres", "select * from pgbench_accounts") # COMPARE RESTORED FILES self.assertEqual(result, result_new, 'data is lost') diff --git a/tests/ptrack.py b/tests/ptrack.py index cbec4653..a0a3b9a2 100644 --- a/tests/ptrack.py +++ b/tests/ptrack.py @@ -295,7 +295,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase): 'wal_level': 'replica', 'max_wal_senders': '2', 'checkpoint_timeout': '300s', - 'ptrack_enable': 'on' + 'ptrack_enable': 'on', + 'autovacuum': 'off' } ) node_restored = self.make_simple_node(