Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8846e19

Browse files
Stabilizy tests. (#411)
* tests: Introduced a new flag for tests -- PGPROBACKUP_GDB * tests: Do travis builds with CFLAGS="-O0" (stabilization of gdb tests) * tests: Run compatibility tests only if PGPROBACKUPBIN_OLD set * tests: Running some tests now depends on PGPROBACKUP_SSH_REMOTE
1 parent 4755139 commit 8846e19

File tree

13 files changed

+109
-59
lines changed

13 files changed

+109
-59
lines changed

‎tests/Readme.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Specify path to pg_probackup binary file. By default tests use <Path to Git repo
3030
Remote backup depends on key authentication to local machine via ssh as current user.
3131
export PGPROBACKUP_SSH_REMOTE=ON
3232
33+
Run tests that are relied on advanced debugging features. For this mode, pg_probackup should be compiled without optimizations. For example:
34+
CFLAGS="-O0" ./configure --prefix=/path/to/prefix --enable-debug --enable-cassert --enable-depend --enable-tap-tests
35+
36+
export PGPROBACKUP_GDB=ON
37+
3338
Run suit of basic simple tests:
3439
export PG_PROBACKUP_TEST_BASIC=ON
3540

‎tests/archive.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,8 @@ def test_archive_catalog_1(self):
15471547
double segment - compressed and not
15481548
"""
15491549
if not self.archive_compress:
1550-
returnself.fail(
1551-
'You need to enable ARCHIVE_COMPRESSION for this test to run')
1550+
self.skipTest('You need to enable ARCHIVE_COMPRESSION '
1551+
'for this test to run')
15521552

15531553
fname = self.id().split('.')[3]
15541554
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
@@ -1602,8 +1602,8 @@ def test_archive_catalog_2(self):
16021602
double segment - compressed and not
16031603
"""
16041604
if not self.archive_compress:
1605-
returnself.fail(
1606-
'You need to enable ARCHIVE_COMPRESSION for this test to run')
1605+
self.skipTest('You need to enable ARCHIVE_COMPRESSION '
1606+
'for this test to run')
16071607

16081608
fname = self.id().split('.')[3]
16091609
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
@@ -1659,6 +1659,9 @@ def test_archive_options(self):
16591659
check that '--archive-host', '--archive-user', '--archiver-port'
16601660
and '--restore-command' are working as expected.
16611661
"""
1662+
if not self.remote:
1663+
self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE"
1664+
" for run this test")
16621665
fname = self.id().split('.')[3]
16631666
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
16641667
node = self.make_simple_node(

‎tests/checkdb.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,11 @@ def test_checkdb_block_validation_sanity(self):
450450
# @unittest.skip("skip")
451451
def test_checkdb_sigint_handling(self):
452452
""""""
453+
if not self.gdb:
454+
self.skipTest(
455+
"Specify PGPROBACKUP_GDB and build without "
456+
"optimizations for run this test"
457+
)
453458
fname = self.id().split('.')[3]
454459
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
455460
node = self.make_simple_node(

‎tests/delta.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ def test_delta_vacuum_full(self):
472472
make node, make full and delta stream backups,
473473
restore them and check data correctness
474474
"""
475+
if not self.gdb:
476+
self.skipTest(
477+
"Specify PGPROBACKUP_GDB and build without "
478+
"optimizations for run this test"
479+
)
475480
fname = self.id().split('.')[3]
476481
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
477482
node = self.make_simple_node(
@@ -508,7 +513,7 @@ def test_delta_vacuum_full(self):
508513
process.start()
509514

510515
while not gdb.stopped_in_breakpoint:
511-
sleep(1)
516+
time.sleep(1)
512517

513518
gdb.continue_execution_until_break(20)
514519

‎tests/external.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ def test_external_backward_compatibility(self):
373373
restore delta backup, check that incremental chain
374374
restored correctly
375375
"""
376+
if not self.probackup_old_path:
377+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
378+
" for run this test")
376379
fname = self.id().split('.')[3]
377380
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
378381
node = self.make_simple_node(
@@ -474,6 +477,9 @@ def test_external_backward_compatibility_merge_1(self):
474477
take delta backup with new binary and 2 external directories
475478
merge delta backup ajd restore it
476479
"""
480+
if not self.probackup_old_path:
481+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
482+
" for run this test")
477483
fname = self.id().split('.')[3]
478484
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
479485
node = self.make_simple_node(
@@ -566,6 +572,9 @@ def test_external_backward_compatibility_merge_2(self):
566572
take delta backup with new binary and 2 external directories
567573
merge delta backup and restore it
568574
"""
575+
if not self.probackup_old_path:
576+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
577+
" for run this test")
569578
fname = self.id().split('.')[3]
570579
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
571580
node = self.make_simple_node(
@@ -687,6 +696,9 @@ def test_external_backward_compatibility_merge_2(self):
687696
# @unittest.skip("skip")
688697
def test_external_merge(self):
689698
""""""
699+
if not self.probackup_old_path:
700+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
701+
" for run this test")
690702
fname = self.id().split('.')[3]
691703
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
692704
node = self.make_simple_node(

‎tests/helpers/ptrack_helpers.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ def __init__(self, *args, **kwargs):
184184
self.test_env['LC_MESSAGES'] = 'C'
185185
self.test_env['LC_TIME'] = 'C'
186186

187-
self.paranoia = False
188-
if'PG_PROBACKUP_PARANOIA'inself.test_env:
189-
ifself.test_env['PG_PROBACKUP_PARANOIA'] =='ON':
190-
self.paranoia=True
191-
192-
self.archive_compress=False
193-
if'ARCHIVE_COMPRESSION' in self.test_env:
194-
ifself.test_env['ARCHIVE_COMPRESSION'] == 'ON':
195-
self.archive_compress=True
187+
self.gdb = 'PGPROBACKUP_GDB'inos.environand \
188+
os.environ['PGPROBACKUP_GDB'] =='ON'
189+
190+
self.paranoia='PG_PROBACKUP_PARANOIA'inself.test_envand \
191+
self.test_env['PG_PROBACKUP_PARANOIA'] =='ON'
192+
193+
self.archive_compress='ARCHIVE_COMPRESSION' in self.test_envand \
194+
self.test_env['ARCHIVE_COMPRESSION'] == 'ON'
195+
196196
try:
197197
testgres.configure_testgres(
198198
cache_initdb=False,

‎tests/pgpro2068.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def test_minrecpoint_on_replica(self):
1818
"""
1919
https://jira.postgrespro.ru/browse/PGPRO-2068
2020
"""
21+
if not self.gdb:
22+
self.skipTest(
23+
"Specify PGPROBACKUP_GDB and build without "
24+
"optimizations for run this test"
25+
)
2126
fname = self.id().split('.')[3]
2227
node = self.make_simple_node(
2328
base_dir=os.path.join(module_name, fname, 'node'),

‎tests/replica.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ def test_replica_promote(self):
625625
def test_replica_stop_lsn_null_offset(self):
626626
"""
627627
"""
628+
if not self.gdb:
629+
self.skipTest(
630+
"Specify PGPROBACKUP_GDB and build without "
631+
"optimizations for run this test"
632+
)
628633
fname = self.id().split('.')[3]
629634
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
630635
master = self.make_simple_node(
@@ -707,6 +712,11 @@ def test_replica_stop_lsn_null_offset(self):
707712
def test_replica_stop_lsn_null_offset_next_record(self):
708713
"""
709714
"""
715+
if not self.gdb:
716+
self.skipTest(
717+
"Specify PGPROBACKUP_GDB and build without "
718+
"optimizations for run this test"
719+
)
710720
fname = self.id().split('.')[3]
711721
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
712722
master = self.make_simple_node(
@@ -976,6 +986,11 @@ def test_replica_toast(self):
976986
make archive master, take full and page archive backups from master,
977987
set replica, make archive backup from replica
978988
"""
989+
if not self.gdb:
990+
self.skipTest(
991+
"Specify PGPROBACKUP_GDB and build without "
992+
"optimizations for run this test"
993+
)
979994
fname = self.id().split('.')[3]
980995
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
981996
master = self.make_simple_node(
@@ -1076,6 +1091,11 @@ def test_replica_toast(self):
10761091
def test_start_stop_lsn_in_the_same_segno(self):
10771092
"""
10781093
"""
1094+
if not self.gdb:
1095+
self.skipTest(
1096+
"Specify PGPROBACKUP_GDB and build without "
1097+
"optimizations for run this test"
1098+
)
10791099
fname = self.id().split('.')[3]
10801100
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
10811101
master = self.make_simple_node(

‎tests/restore.py‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_restore_to_time(self):
189189
node = self.make_simple_node(
190190
base_dir=os.path.join(module_name, fname, 'node'),
191191
initdb_params=['--data-checksums'],
192-
pg_options={'TimeZone': 'Europe/Moscow'})
192+
pg_options={'TimeZone': 'GMT'})
193193

194194
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
195195
self.init_pb(backup_dir)
@@ -202,7 +202,9 @@ def test_restore_to_time(self):
202202

203203
backup_id = self.backup_node(backup_dir, 'node', node)
204204

205-
target_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
205+
target_time = node.execute(
206+
"postgres", "SELECT to_char(now(), 'YYYY-MM-DD HH24:MI:SS+00')"
207+
)[0][0]
206208
pgbench = node.pgbench(
207209
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
208210
pgbench.wait()
@@ -2848,6 +2850,9 @@ def test_partial_restore_backward_compatibility_1(self):
28482850
"""
28492851
old binary should be of version < 2.2.0
28502852
"""
2853+
if not self.probackup_old_path:
2854+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
2855+
" for run this test")
28512856
fname = self.id().split('.')[3]
28522857
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
28532858
node = self.make_simple_node(
@@ -2951,6 +2956,9 @@ def test_partial_restore_backward_compatibility_merge(self):
29512956
"""
29522957
old binary should be of version < 2.2.0
29532958
"""
2959+
if not self.probackup_old_path:
2960+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
2961+
" for run this test")
29542962
fname = self.id().split('.')[3]
29552963
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
29562964
node = self.make_simple_node(
@@ -3643,7 +3651,9 @@ def test_pg_12_probackup_recovery_conf_compatibility(self):
36433651
36443652
pg_probackup version must be 12 or greater
36453653
"""
3646-
3654+
if not self.probackup_old_path:
3655+
self.skipTest("You must specify PGPROBACKUPBIN_OLD"
3656+
" for run this test")
36473657
if self.pg_config_version < self.version_to_num('12.0'):
36483658
return unittest.skip('You need PostgreSQL >= 12 for this test')
36493659

‎tests/show.py‎

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ def test_corrupt_control_file(self):
212212
# @unittest.expectedFailure
213213
def test_corrupt_correctness(self):
214214
"""backup.control contains invalid option"""
215+
if not self.remote:
216+
self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE"
217+
" for run this test")
215218
fname = self.id().split('.')[3]
216219
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
217220
node = self.make_simple_node(
@@ -232,12 +235,7 @@ def test_corrupt_correctness(self):
232235
output_local = self.show_pb(
233236
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
234237

235-
if self.remote:
236-
backup_remote_id = self.backup_node(backup_dir, 'node', node)
237-
else:
238-
backup_remote_id = self.backup_node(
239-
backup_dir, 'node', node,
240-
options=['--remote-proto=ssh', '--remote-host=localhost'])
238+
backup_remote_id = self.backup_node(backup_dir, 'node', node)
241239

242240
output_remote = self.show_pb(
243241
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -260,13 +258,8 @@ def test_corrupt_correctness(self):
260258
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
261259
self.delete_pb(backup_dir, 'node', backup_local_id)
262260

263-
if self.remote:
264-
backup_remote_id = self.backup_node(
265-
backup_dir, 'node', node, backup_type='delta')
266-
else:
267-
backup_remote_id = self.backup_node(
268-
backup_dir, 'node', node, backup_type='delta',
269-
options=['--remote-proto=ssh', '--remote-host=localhost'])
261+
backup_remote_id = self.backup_node(
262+
backup_dir, 'node', node, backup_type='delta')
270263

271264
output_remote = self.show_pb(
272265
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -290,13 +283,8 @@ def test_corrupt_correctness(self):
290283
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
291284
self.delete_pb(backup_dir, 'node', backup_local_id)
292285

293-
if self.remote:
294-
backup_remote_id = self.backup_node(
295-
backup_dir, 'node', node, backup_type='page')
296-
else:
297-
backup_remote_id = self.backup_node(
298-
backup_dir, 'node', node, backup_type='page',
299-
options=['--remote-proto=ssh', '--remote-host=localhost'])
286+
backup_remote_id = self.backup_node(
287+
backup_dir, 'node', node, backup_type='page')
300288

301289
output_remote = self.show_pb(
302290
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -318,6 +306,9 @@ def test_corrupt_correctness(self):
318306
# @unittest.expectedFailure
319307
def test_corrupt_correctness_1(self):
320308
"""backup.control contains invalid option"""
309+
if not self.remote:
310+
self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE"
311+
" for run this test")
321312
fname = self.id().split('.')[3]
322313
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
323314
node = self.make_simple_node(
@@ -338,12 +329,7 @@ def test_corrupt_correctness_1(self):
338329
output_local = self.show_pb(
339330
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
340331

341-
if self.remote:
342-
backup_remote_id = self.backup_node(backup_dir, 'node', node)
343-
else:
344-
backup_remote_id = self.backup_node(
345-
backup_dir, 'node', node,
346-
options=['--remote-proto=ssh', '--remote-host=localhost'])
332+
backup_remote_id = self.backup_node(backup_dir, 'node', node)
347333

348334
output_remote = self.show_pb(
349335
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -370,13 +356,8 @@ def test_corrupt_correctness_1(self):
370356
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
371357
self.delete_pb(backup_dir, 'node', backup_local_id)
372358

373-
if self.remote:
374-
backup_remote_id = self.backup_node(
375-
backup_dir, 'node', node, backup_type='delta')
376-
else:
377-
backup_remote_id = self.backup_node(
378-
backup_dir, 'node', node, backup_type='delta',
379-
options=['--remote-proto=ssh', '--remote-host=localhost'])
359+
backup_remote_id = self.backup_node(
360+
backup_dir, 'node', node, backup_type='delta')
380361

381362
output_remote = self.show_pb(
382363
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -400,13 +381,8 @@ def test_corrupt_correctness_1(self):
400381
backup_dir, 'node', as_json=False, backup_id=backup_local_id)
401382
self.delete_pb(backup_dir, 'node', backup_local_id)
402383

403-
if self.remote:
404-
backup_remote_id = self.backup_node(
405-
backup_dir, 'node', node, backup_type='page')
406-
else:
407-
backup_remote_id = self.backup_node(
408-
backup_dir, 'node', node, backup_type='page',
409-
options=['--remote-proto=ssh', '--remote-host=localhost'])
384+
backup_remote_id = self.backup_node(
385+
backup_dir, 'node', node, backup_type='page')
410386

411387
output_remote = self.show_pb(
412388
backup_dir, 'node', as_json=False, backup_id=backup_remote_id)
@@ -428,6 +404,9 @@ def test_corrupt_correctness_1(self):
428404
# @unittest.expectedFailure
429405
def test_corrupt_correctness_2(self):
430406
"""backup.control contains invalid option"""
407+
if not self.remote:
408+
self.skipTest("You must enable PGPROBACKUP_SSH_REMOTE"
409+
" for run this test")
431410
fname = self.id().split('.')[3]
432411
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
433412
node = self.make_simple_node(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /