Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 2 additions & 0 deletions tests/helpers/ptrack_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
22 changes: 22 additions & 0 deletions tests/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -625,6 +627,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 +714,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 +988,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 +1093,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
6 changes: 6 additions & 0 deletions tests/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
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
2 changes: 1 addition & 1 deletion travis/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down