Skip to content

Commit 20de566

Browse files
committed
tests: minor fixes
1 parent c3aa3f0 commit 20de566

File tree

6 files changed

+22
-27
lines changed

6 files changed

+22
-27
lines changed

tests/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
from . import init_test, merge, option_test, show_test, compatibility, \
44
backup_test, delete_test, delta, restore_test, validate_test, \
5-
retention_test, ptrack_clean, ptrack_empty, ptrack_cluster, \
6-
ptrack_move_to_tablespace, ptrack_recovery, ptrack_truncate, \
7-
ptrack_vacuum, ptrack_vacuum_bits_frozen, ptrack_vacuum_bits_visibility, \
8-
ptrack_vacuum_full, ptrack_vacuum_truncate, pgpro560, pgpro589, \
9-
false_positive, replica, compression, page, ptrack, archive, \
10-
exclude, cfs_backup, cfs_restore, cfs_validate_backup, auth_test, \
11-
time_stamp, snapfs, logging, locking, remote
5+
retention_test, pgpro560, pgpro589, false_positive, replica, \
6+
compression, page, ptrack, archive, exclude, cfs_backup, cfs_restore, \
7+
cfs_validate_backup, auth_test, time_stamp, snapfs, logging, \
8+
locking, remote
129

1310

1411
def load_tests(loader, tests, pattern):

tests/delta.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,7 @@ def test_delta_vacuum_full(self):
557557
gdb = self.gdb_attach(pid)
558558
gdb.set_breakpoint('reform_and_rewrite_tuple')
559559

560-
if not gdb.continue_execution_until_running():
561-
print('Failed gdb continue')
562-
exit(1)
560+
gdb.continue_execution_until_running()
563561

564562
acurs.execute("VACUUM FULL t_heap")
565563

tests/helpers/ptrack_helpers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,18 +1361,17 @@ def run_until_break(self):
13611361
def continue_execution_until_running(self):
13621362
result = self._execute('continue')
13631363

1364-
running = False
13651364
for line in result:
1366-
if line.startswith('*running'):
1367-
running = True
1368-
break
1365+
if line.startswith('*running') or line.startswith('^running'):
1366+
return
13691367
if line.startswith('*stopped,reason="breakpoint-hit"'):
1370-
running = False
13711368
continue
13721369
if line.startswith('*stopped,reason="exited-normally"'):
1373-
running = False
13741370
continue
1375-
return running
1371+
1372+
raise GdbException(
1373+
'Failed to continue execution until running.\n'
1374+
)
13761375

13771376
def continue_execution_until_exit(self):
13781377
result = self._execute('continue', False)
@@ -1383,10 +1382,11 @@ def continue_execution_until_exit(self):
13831382
if line.startswith('*stopped,reason="breakpoint-hit"'):
13841383
continue
13851384
if (
1386-
line.startswith('*stopped,reason="exited"') or
1385+
line.startswith('*stopped,reason="exited') or
13871386
line == '*stopped\n'
13881387
):
13891388
return
1389+
13901390
raise GdbException(
13911391
'Failed to continue execution until exit.\n'
13921392
)
@@ -1420,6 +1420,7 @@ def continue_execution_until_break(self, ignore_count=0):
14201420
return 'breakpoint-hit'
14211421
if line.startswith('*stopped,reason="exited-normally"'):
14221422
return 'exited-normally'
1423+
14231424
if running:
14241425
return 'running'
14251426

tests/page.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def test_page_backup_with_lost_wal_segment(self):
691691
# delete last wal segment
692692
wals_dir = os.path.join(backup_dir, 'wal', 'node')
693693
wals = [f for f in os.listdir(wals_dir) if os.path.isfile(os.path.join(
694-
wals_dir, f)) and not f.endswith('.backup')]
694+
wals_dir, f)) and not f.endswith('.backup') and not f.endswith('.partial')]
695695
wals = map(str, wals)
696696
file = os.path.join(wals_dir, max(wals))
697697
os.remove(file)
@@ -701,8 +701,7 @@ def test_page_backup_with_lost_wal_segment(self):
701701
# Single-thread PAGE backup
702702
try:
703703
self.backup_node(
704-
backup_dir, 'node', node,
705-
backup_type='page')
704+
backup_dir, 'node', node, backup_type='page')
706705
self.assertEqual(
707706
1, 0,
708707
"Expecting Error because of wal segment disappearance.\n "

tests/ptrack.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import unittest
3-
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
3+
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
44
from datetime import datetime, timedelta
55
import subprocess
66
from testgres import QueryException
@@ -236,9 +236,7 @@ def test_ptrack_vacuum_full(self):
236236
gdb = self.gdb_attach(pid)
237237
gdb.set_breakpoint('reform_and_rewrite_tuple')
238238

239-
if not gdb.continue_execution_until_running():
240-
print('Failed gdb continue')
241-
exit(1)
239+
gdb.continue_execution_until_running()
242240

243241
acurs.execute("VACUUM FULL t_heap")
244242

tests/restore_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,8 +1174,7 @@ def test_archive_node_backup_archive_pitr_2(self):
11741174
backup_dir, 'node', node_restored,
11751175
options=[
11761176
"-j", "4", '--time={0}'.format(recovery_time),
1177-
"--recovery-target-action=promote"
1178-
]
1177+
"--recovery-target-action=promote"]
11791178
),
11801179
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
11811180
repr(self.output), self.cmd))
@@ -1184,6 +1183,9 @@ def test_archive_node_backup_archive_pitr_2(self):
11841183
pgdata_restored = self.pgdata_content(node_restored.data_dir)
11851184
self.compare_pgdata(pgdata, pgdata_restored)
11861185

1186+
node_restored.append_conf(
1187+
"postgresql.auto.conf", "port = {0}".format(node_restored.port))
1188+
11871189
node_restored.slow_start()
11881190

11891191
result = node_restored.psql("postgres", 'select * from t_heap')

0 commit comments

Comments
 (0)