From a71829db3366a5412f5445d011a2a51713df6b01 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Tue, 15 Oct 2019 21:48:37 +0300 Subject: [PATCH] tests: minor improvements --- tests/merge.py | 19 +++++++------------ tests/replica.py | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tests/merge.py b/tests/merge.py index 8a6f2981..81d609ad 100644 --- a/tests/merge.py +++ b/tests/merge.py @@ -1068,7 +1068,7 @@ class MergeTest(ProbackupTest, unittest.TestCase): # Clean after yourself self.del_test_dir(module_name, fname) - # @unittest.skip("skip") + @unittest.skip("skip") def test_continue_failed_merge_with_corrupted_delta_backup(self): """ Fail merge via gdb, corrupt DELTA backup, try to continue merge @@ -1091,8 +1091,7 @@ class MergeTest(ProbackupTest, unittest.TestCase): "postgres", "create table t_heap as select i as id," " md5(i::text) as text, md5(i::text)::tsvector as tsvector" - " from generate_series(0,1000) i" - ) + " from generate_series(0,1000) i") old_path = node.safe_psql( "postgres", @@ -1100,18 +1099,15 @@ class MergeTest(ProbackupTest, unittest.TestCase): # DELTA BACKUP self.backup_node( - backup_dir, 'node', node, backup_type='delta' - ) + backup_dir, 'node', node, backup_type='delta') node.safe_psql( "postgres", - "update t_heap set id = 100500" - ) + "update t_heap set id = 100500") node.safe_psql( "postgres", - "vacuum full t_heap" - ) + "vacuum full t_heap") new_path = node.safe_psql( "postgres", @@ -1119,8 +1115,7 @@ class MergeTest(ProbackupTest, unittest.TestCase): # DELTA BACKUP backup_id_2 = self.backup_node( - backup_dir, 'node', node, backup_type='delta' - ) + backup_dir, 'node', node, backup_type='delta') backup_id = self.show_pb(backup_dir, "node")[1]["id"] @@ -1155,7 +1150,7 @@ class MergeTest(ProbackupTest, unittest.TestCase): # Try to continue failed MERGE try: - self.merge_backup(backup_dir, "node", backup_id) + print(self.merge_backup(backup_dir, "node", backup_id)) self.assertEqual( 1, 0, "Expecting Error because of incremental backup corruption.\n " diff --git a/tests/replica.py b/tests/replica.py index b368b93e..c4d4cc95 100644 --- a/tests/replica.py +++ b/tests/replica.py @@ -890,6 +890,7 @@ class ReplicaTest(ProbackupTest, unittest.TestCase): set_replication=True, initdb_params=['--data-checksums'], pg_options={ + 'autovacuum': 'off', 'checkpoint_timeout': '1h', 'wal_level': 'replica'}) @@ -924,6 +925,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase): self.switch_wal_segment(master) self.switch_wal_segment(master) + self.wait_until_replica_catch_with_master(master, replica) + master.safe_psql( 'postgres', 'CREATE TABLE t1 AS ' @@ -951,12 +954,23 @@ class ReplicaTest(ProbackupTest, unittest.TestCase): 'LOG: Found prior LSN:', output) - print(output) + res1 = replica.safe_psql( + 'postgres', + 'select md5(fat_attr) from t1') replica.cleanup() - self.restore_node(backup_dir, 'replica', replica) + self.restore_node(backup_dir, 'replica', replica) pgdata_restored = self.pgdata_content(replica.data_dir) + + replica.slow_start() + + res2 = replica.safe_psql( + 'postgres', + 'select md5(fat_attr) from t1') + + self.assertEqual(res1, res2) + self.compare_pgdata(pgdata, pgdata_restored) # Clean after yourself