Skip to content

Stabilizy tests. #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ Specify path to pg_probackup binary file. By default tests use <Path to Git repo
Remote backup depends on key authentication to local machine via ssh as current user.
export PGPROBACKUP_SSH_REMOTE=ON

Run tests that are relied on advanced debugging features. For this mode, pg_probackup should be compiled without optimizations. For example:
CFLAGS="-O0" ./configure --prefix=/path/to/prefix --enable-debug --enable-cassert --enable-depend --enable-tap-tests

export PGPROBACKUP_GDB=ON

Run suit of basic simple tests:
export PG_PROBACKUP_TEST_BASIC=ON

Expand Down
11 changes: 7 additions & 4 deletions tests/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -1659,6 +1659,9 @@ def test_archive_options(self):
check that '--archive-host', '--archive-user', '--archiver-port'
and '--restore-command' are working as expected.
"""
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(
Expand Down
5 changes: 5 additions & 0 deletions tests/checkdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion tests/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions tests/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions tests/helpers/ptrack_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,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.archive_compress = False
if 'ARCHIVE_COMPRESSION' in self.test_env:
if self.test_env['ARCHIVE_COMPRESSION'] == 'ON':
self.archive_compress = 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'

try:
testgres.configure_testgres(
cache_initdb=False,
Expand Down
5 changes: 5 additions & 0 deletions tests/pgpro2068.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
20 changes: 20 additions & 0 deletions tests/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
16 changes: 13 additions & 3 deletions tests/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -2848,6 +2850,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(
Expand Down Expand Up @@ -2951,6 +2956,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(
Expand Down Expand Up @@ -3643,7 +3651,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')

Expand Down
59 changes: 19 additions & 40 deletions tests/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -232,12 +235,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)
Expand All @@ -260,13 +258,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)
Expand All @@ -290,13 +283,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)
Expand All @@ -318,6 +306,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(
Expand All @@ -338,12 +329,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)
Expand All @@ -370,13 +356,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)
Expand All @@ -400,13 +381,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)
Expand All @@ -428,6 +404,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(
Expand Down
3 changes: 2 additions & 1 deletion tests/snapfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
5 changes: 5 additions & 0 deletions tests/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Loading