From 43200311588a0d4c74bbae53ed7d57e1142ba88c Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Thu, 15 Jul 2021 14:31:56 +0700 Subject: [PATCH 01/10] tests: Run compatibility tests only if PGPROBACKUPBIN_OLD set --- tests/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index dbf84feea..5c8231ffb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -23,7 +23,8 @@ def load_tests(loader, tests, pattern): # suite.addTests(loader.loadTestsFromModule(auth_test)) suite.addTests(loader.loadTestsFromModule(archive)) suite.addTests(loader.loadTestsFromModule(backup)) - suite.addTests(loader.loadTestsFromModule(compatibility)) + if 'PGPROBACKUPBIN_OLD' in os.environ and os.environ['PGPROBACKUPBIN_OLD']: + suite.addTests(loader.loadTestsFromModule(compatibility)) suite.addTests(loader.loadTestsFromModule(checkdb)) suite.addTests(loader.loadTestsFromModule(config)) # suite.addTests(loader.loadTestsFromModule(cfs_backup)) From 8400a368c15e50cfbdada93a7143fd4c44f4137d Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Wed, 21 Jul 2021 11:14:50 +0700 Subject: [PATCH 02/10] tests: Stabilizy tests part 1 --- tests/archive.py | 14 ++++++++++---- tests/checkdb.py | 5 +++++ tests/delta.py | 7 ++++++- tests/external.py | 12 ++++++++++++ tests/helpers/ptrack_helpers.py | 2 ++ tests/pgpro2068.py | 5 +++++ tests/replica.py | 20 ++++++++++++++++++++ tests/restore.py | 10 +++++++++- tests/validate.py | 5 +++++ 9 files changed, 74 insertions(+), 6 deletions(-) diff --git a/tests/archive.py b/tests/archive.py index 44fd7bcfb..34e5a6980 100644 --- a/tests/archive.py +++ b/tests/archive.py @@ -1547,8 +1547,8 @@ def test_archive_catalog_1(self): double segment - compressed and not """ if not self.archive_compress: - return self.fail( - 'You need to enable ARCHIVE_COMPRESSION for this test to run') + self.skipTest('You need to enable ARCHIVE_COMPRESSION ' + 'for this test to run') fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') @@ -1602,8 +1602,8 @@ def test_archive_catalog_2(self): double segment - compressed and not """ if not self.archive_compress: - return self.fail( - 'You need to enable ARCHIVE_COMPRESSION for this test to run') + self.skipTest('You need to enable ARCHIVE_COMPRESSION ' + 'for this test to run') fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') @@ -1659,6 +1659,12 @@ def test_archive_options(self): check that '--archive-host', '--archive-user', '--archiver-port' and '--restore-command' are working as expected. """ + tryssh = subprocess.call( + "ssh -o PasswordAuthentication=no localhost ':'", + shell=True) + if tryssh != 0: + self.skipTest('You must configure keypair on ' + 'localhost for run this test') fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( diff --git a/tests/checkdb.py b/tests/checkdb.py index 5b7a156cc..aecd4bde1 100644 --- a/tests/checkdb.py +++ b/tests/checkdb.py @@ -450,6 +450,11 @@ def test_checkdb_block_validation_sanity(self): # @unittest.skip("skip") def test_checkdb_sigint_handling(self): """""" + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( diff --git a/tests/delta.py b/tests/delta.py index c2f58d10f..f365b6f9b 100644 --- a/tests/delta.py +++ b/tests/delta.py @@ -472,6 +472,11 @@ def test_delta_vacuum_full(self): make node, make full and delta stream backups, restore them and check data correctness """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -508,7 +513,7 @@ def test_delta_vacuum_full(self): process.start() while not gdb.stopped_in_breakpoint: - sleep(1) + time.sleep(1) gdb.continue_execution_until_break(20) diff --git a/tests/external.py b/tests/external.py index 5c970f57b..530e7fb26 100644 --- a/tests/external.py +++ b/tests/external.py @@ -373,6 +373,9 @@ def test_external_backward_compatibility(self): restore delta backup, check that incremental chain restored correctly """ + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -474,6 +477,9 @@ def test_external_backward_compatibility_merge_1(self): take delta backup with new binary and 2 external directories merge delta backup ajd restore it """ + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -566,6 +572,9 @@ def test_external_backward_compatibility_merge_2(self): take delta backup with new binary and 2 external directories merge delta backup and restore it """ + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -687,6 +696,9 @@ def test_external_backward_compatibility_merge_2(self): # @unittest.skip("skip") def test_external_merge(self): """""" + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( diff --git a/tests/helpers/ptrack_helpers.py b/tests/helpers/ptrack_helpers.py index bf84f266e..465710ca9 100644 --- a/tests/helpers/ptrack_helpers.py +++ b/tests/helpers/ptrack_helpers.py @@ -151,6 +151,8 @@ def slow_start(self, replica=False): class ProbackupTest(object): # Class attributes enterprise = is_enterprise() + gdb = 'PGPROBACKUP_GDB' in os.environ and \ + os.environ['PGPROBACKUP_GDB'] == 'ON' def __init__(self, *args, **kwargs): super(ProbackupTest, self).__init__(*args, **kwargs) diff --git a/tests/pgpro2068.py b/tests/pgpro2068.py index e373a84b8..fc0cb50bd 100644 --- a/tests/pgpro2068.py +++ b/tests/pgpro2068.py @@ -18,6 +18,11 @@ def test_minrecpoint_on_replica(self): """ https://jira.postgrespro.ru/browse/PGPRO-2068 """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] node = self.make_simple_node( base_dir=os.path.join(module_name, fname, 'node'), diff --git a/tests/replica.py b/tests/replica.py index d59b11dbf..828305da7 100644 --- a/tests/replica.py +++ b/tests/replica.py @@ -625,6 +625,11 @@ def test_replica_promote(self): def test_replica_stop_lsn_null_offset(self): """ """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( @@ -707,6 +712,11 @@ def test_replica_stop_lsn_null_offset(self): def test_replica_stop_lsn_null_offset_next_record(self): """ """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( @@ -976,6 +986,11 @@ def test_replica_toast(self): make archive master, take full and page archive backups from master, set replica, make archive backup from replica """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( @@ -1076,6 +1091,11 @@ def test_replica_toast(self): def test_start_stop_lsn_in_the_same_segno(self): """ """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( diff --git a/tests/restore.py b/tests/restore.py index 8ccffa44c..36094d385 100644 --- a/tests/restore.py +++ b/tests/restore.py @@ -2848,6 +2848,9 @@ def test_partial_restore_backward_compatibility_1(self): """ old binary should be of version < 2.2.0 """ + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -2951,6 +2954,9 @@ def test_partial_restore_backward_compatibility_merge(self): """ old binary should be of version < 2.2.0 """ + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -3643,7 +3649,9 @@ def test_pg_12_probackup_recovery_conf_compatibility(self): pg_probackup version must be 12 or greater """ - + if not self.probackup_old_path: + self.skipTest("You must specify PGPROBACKUPBIN_OLD" + " for run this test") if self.pg_config_version < self.version_to_num('12.0'): return unittest.skip('You need PostgreSQL >= 12 for this test') diff --git a/tests/validate.py b/tests/validate.py index c5cc80733..0b04d92fe 100644 --- a/tests/validate.py +++ b/tests/validate.py @@ -1088,6 +1088,11 @@ def test_validate_instance_with_several_corrupt_backups_interrupt(self): """ check that interrupt during validation is handled correctly """ + if not self.gdb: + self.skipTest( + "Specify PGPROBACKUP_GDB and build without " + "optimizations for run this test" + ) fname = self.id().split('.')[3] node = self.make_simple_node( base_dir=os.path.join(module_name, fname, 'node'), From 2288aa7ec674cd879e7780e8ef3d210c796810bf Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Mon, 26 Jul 2021 11:23:41 +0700 Subject: [PATCH 03/10] tests: Readme for PGPROBACKUP_GDB --- tests/Readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Readme.md b/tests/Readme.md index f8dd91db0..b9613a0c6 100644 --- a/tests/Readme.md +++ b/tests/Readme.md @@ -30,6 +30,9 @@ Specify path to pg_probackup binary file. By default tests use Date: Mon, 26 Jul 2021 11:29:38 +0700 Subject: [PATCH 04/10] tests: Change skip remote test after review --- tests/archive.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/archive.py b/tests/archive.py index 34e5a6980..0ade2d66a 100644 --- a/tests/archive.py +++ b/tests/archive.py @@ -1659,12 +1659,9 @@ def test_archive_options(self): check that '--archive-host', '--archive-user', '--archiver-port' and '--restore-command' are working as expected. """ - tryssh = subprocess.call( - "ssh -o PasswordAuthentication=no localhost ':'", - shell=True) - if tryssh != 0: - self.skipTest('You must configure keypair on ' - 'localhost for run this test') + if not self.remote: + self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( From 714811faed40ce15f4b7e5fac0724c3b78f71698 Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Mon, 26 Jul 2021 11:30:52 +0700 Subject: [PATCH 05/10] tests: Build travis'es without optimizations --- travis/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/run_tests.sh b/travis/run_tests.sh index 635b9f422..325b89060 100755 --- a/travis/run_tests.sh +++ b/travis/run_tests.sh @@ -35,7 +35,7 @@ git clone https://github.com/postgres/postgres.git -b $PG_BRANCH --depth=1 # Compile and install Postgres echo "############### Compiling Postgres:" cd postgres # Go to postgres dir -./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests +CFLAGS="-O0" ./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests make -s -j$(nproc) install #make -s -j$(nproc) -C 'src/common' install #make -s -j$(nproc) -C 'src/port' install From b331a1e9962882845e42f316a90d2055b11f0bfa Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Tue, 27 Jul 2021 14:38:51 +0700 Subject: [PATCH 06/10] tests: Stabilizy tests part 2 --- tests/replica.py | 2 ++ tests/restore.py | 6 ++++-- tests/show.py | 6 ++++++ tests/snapfs.py | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/replica.py b/tests/replica.py index 828305da7..d21b61a18 100644 --- a/tests/replica.py +++ b/tests/replica.py @@ -224,6 +224,8 @@ def test_replica_archive_page_backup(self): make archive master, take full and page archive backups from master, set replica, make archive backup from replica """ + if not self.remote: + self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( diff --git a/tests/restore.py b/tests/restore.py index 36094d385..d0353d05f 100644 --- a/tests/restore.py +++ b/tests/restore.py @@ -189,7 +189,7 @@ def test_restore_to_time(self): node = self.make_simple_node( base_dir=os.path.join(module_name, fname, 'node'), initdb_params=['--data-checksums'], - pg_options={'TimeZone': 'Europe/Moscow'}) + pg_options={'TimeZone': 'GMT'}) backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') self.init_pb(backup_dir) @@ -202,7 +202,9 @@ def test_restore_to_time(self): backup_id = self.backup_node(backup_dir, 'node', node) - target_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") + target_time = node.execute( + "postgres", "SELECT to_char(now(), 'YYYY-MM-DD HH24:MI:SS+00')" + )[0][0] pgbench = node.pgbench( stdout=subprocess.PIPE, stderr=subprocess.STDOUT) pgbench.wait() diff --git a/tests/show.py b/tests/show.py index 2a13a768b..6c9713a1b 100644 --- a/tests/show.py +++ b/tests/show.py @@ -318,6 +318,9 @@ def test_corrupt_correctness(self): # @unittest.expectedFailure def test_corrupt_correctness_1(self): """backup.control contains invalid option""" + if not self.remote: + self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( @@ -428,6 +431,9 @@ def test_corrupt_correctness_1(self): # @unittest.expectedFailure def test_corrupt_correctness_2(self): """backup.control contains invalid option""" + if not self.remote: + self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node( diff --git a/tests/snapfs.py b/tests/snapfs.py index a7f926c4c..991741952 100644 --- a/tests/snapfs.py +++ b/tests/snapfs.py @@ -10,9 +10,10 @@ class SnapFSTest(ProbackupTest, unittest.TestCase): # @unittest.expectedFailure - @unittest.skipUnless(ProbackupTest.enterprise, 'skip') def test_snapfs_simple(self): """standart backup modes with ARCHIVE WAL method""" + if not self.enterprise: + self.skipTest('This test must be run on enterprise') fname = self.id().split('.')[3] node = self.make_simple_node( base_dir=os.path.join(module_name, fname, 'node'), From 75c25d0de0f5510b630662af4424e2309c03697d Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Tue, 3 Aug 2021 11:08:24 +0700 Subject: [PATCH 07/10] tests: Extend readme after review --- tests/Readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Readme.md b/tests/Readme.md index b9613a0c6..668552c94 100644 --- a/tests/Readme.md +++ b/tests/Readme.md @@ -30,7 +30,9 @@ Specify path to pg_probackup binary file. By default tests use Date: Tue, 3 Aug 2021 23:38:06 +0700 Subject: [PATCH 08/10] tests: Some reviews for stabilizy tests --- tests/helpers/ptrack_helpers.py | 18 ++++++++---------- tests/replica.py | 2 -- tests/show.py | 25 +++++-------------------- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/tests/helpers/ptrack_helpers.py b/tests/helpers/ptrack_helpers.py index 465710ca9..1f630af3b 100644 --- a/tests/helpers/ptrack_helpers.py +++ b/tests/helpers/ptrack_helpers.py @@ -151,8 +151,6 @@ def slow_start(self, replica=False): class ProbackupTest(object): # Class attributes enterprise = is_enterprise() - gdb = 'PGPROBACKUP_GDB' in os.environ and \ - os.environ['PGPROBACKUP_GDB'] == 'ON' def __init__(self, *args, **kwargs): super(ProbackupTest, self).__init__(*args, **kwargs) @@ -186,15 +184,15 @@ def __init__(self, *args, **kwargs): self.test_env['LC_MESSAGES'] = 'C' self.test_env['LC_TIME'] = 'C' - self.paranoia = False - if 'PG_PROBACKUP_PARANOIA' in self.test_env: - if self.test_env['PG_PROBACKUP_PARANOIA'] == 'ON': - self.paranoia = True + self.gdb = 'PGPROBACKUP_GDB' in os.environ and \ + os.environ['PGPROBACKUP_GDB'] == 'ON' + + self.paranoia = 'PG_PROBACKUP_PARANOIA' in self.test_env and \ + self.test_env['PG_PROBACKUP_PARANOIA'] == 'ON' + + self.archive_compress = 'ARCHIVE_COMPRESSION' in self.test_env and \ + self.test_env['ARCHIVE_COMPRESSION'] == 'ON' - self.archive_compress = False - if 'ARCHIVE_COMPRESSION' in self.test_env: - if self.test_env['ARCHIVE_COMPRESSION'] == 'ON': - self.archive_compress = True try: testgres.configure_testgres( cache_initdb=False, diff --git a/tests/replica.py b/tests/replica.py index d21b61a18..828305da7 100644 --- a/tests/replica.py +++ b/tests/replica.py @@ -224,8 +224,6 @@ def test_replica_archive_page_backup(self): make archive master, take full and page archive backups from master, set replica, make archive backup from replica """ - if not self.remote: - self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') master = self.make_simple_node( diff --git a/tests/show.py b/tests/show.py index 6c9713a1b..0a2cb5a78 100644 --- a/tests/show.py +++ b/tests/show.py @@ -341,12 +341,7 @@ def test_corrupt_correctness_1(self): output_local = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_local_id) - if self.remote: - backup_remote_id = self.backup_node(backup_dir, 'node', node) - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node(backup_dir, 'node', node) output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) @@ -373,13 +368,8 @@ def test_corrupt_correctness_1(self): backup_dir, 'node', as_json=False, backup_id=backup_local_id) self.delete_pb(backup_dir, 'node', backup_local_id) - if self.remote: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='delta') - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='delta', - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node( + backup_dir, 'node', node, backup_type='delta') output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) @@ -403,13 +393,8 @@ def test_corrupt_correctness_1(self): backup_dir, 'node', as_json=False, backup_id=backup_local_id) self.delete_pb(backup_dir, 'node', backup_local_id) - if self.remote: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='page') - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='page', - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node( + backup_dir, 'node', node, backup_type='page') output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) From 37fce57a8435ed3d9339aac059df539b1e502fa6 Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Tue, 3 Aug 2021 23:59:46 +0700 Subject: [PATCH 09/10] tests: Another some reviews for stabilizy tests --- tests/show.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/tests/show.py b/tests/show.py index 0a2cb5a78..3d3064e46 100644 --- a/tests/show.py +++ b/tests/show.py @@ -232,12 +232,7 @@ def test_corrupt_correctness(self): output_local = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_local_id) - if self.remote: - backup_remote_id = self.backup_node(backup_dir, 'node', node) - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node(backup_dir, 'node', node) output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) @@ -260,13 +255,8 @@ def test_corrupt_correctness(self): backup_dir, 'node', as_json=False, backup_id=backup_local_id) self.delete_pb(backup_dir, 'node', backup_local_id) - if self.remote: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='delta') - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='delta', - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node( + backup_dir, 'node', node, backup_type='delta') output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) @@ -290,13 +280,8 @@ def test_corrupt_correctness(self): backup_dir, 'node', as_json=False, backup_id=backup_local_id) self.delete_pb(backup_dir, 'node', backup_local_id) - if self.remote: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='page') - else: - backup_remote_id = self.backup_node( - backup_dir, 'node', node, backup_type='page', - options=['--remote-proto=ssh', '--remote-host=localhost']) + backup_remote_id = self.backup_node( + backup_dir, 'node', node, backup_type='page') output_remote = self.show_pb( backup_dir, 'node', as_json=False, backup_id=backup_remote_id) From c3feb359b344493545640b8300477e82be4d30b1 Mon Sep 17 00:00:00 2001 From: "Andrew A. Bille" Date: Wed, 4 Aug 2021 00:02:45 +0700 Subject: [PATCH 10/10] tests: Another some reviews for stabilizy tests, ooops --- tests/show.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/show.py b/tests/show.py index 3d3064e46..b1ebebf18 100644 --- a/tests/show.py +++ b/tests/show.py @@ -212,6 +212,9 @@ def test_corrupt_control_file(self): # @unittest.expectedFailure def test_corrupt_correctness(self): """backup.control contains invalid option""" + if not self.remote: + self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE" + " for run this test") fname = self.id().split('.')[3] backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup') node = self.make_simple_node(