mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-03-26 22:20:10 +02:00
tests: minor fixes
This commit is contained in:
parent
c3aa3f0cff
commit
20de566010
@ -2,13 +2,10 @@ import unittest
|
||||
|
||||
from . import init_test, merge, option_test, show_test, compatibility, \
|
||||
backup_test, delete_test, delta, restore_test, validate_test, \
|
||||
retention_test, ptrack_clean, ptrack_empty, ptrack_cluster, \
|
||||
ptrack_move_to_tablespace, ptrack_recovery, ptrack_truncate, \
|
||||
ptrack_vacuum, ptrack_vacuum_bits_frozen, ptrack_vacuum_bits_visibility, \
|
||||
ptrack_vacuum_full, ptrack_vacuum_truncate, pgpro560, pgpro589, \
|
||||
false_positive, replica, compression, page, ptrack, archive, \
|
||||
exclude, cfs_backup, cfs_restore, cfs_validate_backup, auth_test, \
|
||||
time_stamp, snapfs, logging, locking, remote
|
||||
retention_test, pgpro560, pgpro589, false_positive, replica, \
|
||||
compression, page, ptrack, archive, exclude, cfs_backup, cfs_restore, \
|
||||
cfs_validate_backup, auth_test, time_stamp, snapfs, logging, \
|
||||
locking, remote
|
||||
|
||||
|
||||
def load_tests(loader, tests, pattern):
|
||||
|
@ -557,9 +557,7 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
||||
gdb = self.gdb_attach(pid)
|
||||
gdb.set_breakpoint('reform_and_rewrite_tuple')
|
||||
|
||||
if not gdb.continue_execution_until_running():
|
||||
print('Failed gdb continue')
|
||||
exit(1)
|
||||
gdb.continue_execution_until_running()
|
||||
|
||||
acurs.execute("VACUUM FULL t_heap")
|
||||
|
||||
|
@ -1361,18 +1361,17 @@ class GDBobj(ProbackupTest):
|
||||
def continue_execution_until_running(self):
|
||||
result = self._execute('continue')
|
||||
|
||||
running = False
|
||||
for line in result:
|
||||
if line.startswith('*running'):
|
||||
running = True
|
||||
break
|
||||
if line.startswith('*running') or line.startswith('^running'):
|
||||
return
|
||||
if line.startswith('*stopped,reason="breakpoint-hit"'):
|
||||
running = False
|
||||
continue
|
||||
if line.startswith('*stopped,reason="exited-normally"'):
|
||||
running = False
|
||||
continue
|
||||
return running
|
||||
|
||||
raise GdbException(
|
||||
'Failed to continue execution until running.\n'
|
||||
)
|
||||
|
||||
def continue_execution_until_exit(self):
|
||||
result = self._execute('continue', False)
|
||||
@ -1383,10 +1382,11 @@ class GDBobj(ProbackupTest):
|
||||
if line.startswith('*stopped,reason="breakpoint-hit"'):
|
||||
continue
|
||||
if (
|
||||
line.startswith('*stopped,reason="exited"') or
|
||||
line.startswith('*stopped,reason="exited') or
|
||||
line == '*stopped\n'
|
||||
):
|
||||
return
|
||||
|
||||
raise GdbException(
|
||||
'Failed to continue execution until exit.\n'
|
||||
)
|
||||
@ -1420,6 +1420,7 @@ class GDBobj(ProbackupTest):
|
||||
return 'breakpoint-hit'
|
||||
if line.startswith('*stopped,reason="exited-normally"'):
|
||||
return 'exited-normally'
|
||||
|
||||
if running:
|
||||
return 'running'
|
||||
|
||||
|
@ -691,7 +691,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
# delete last wal segment
|
||||
wals_dir = os.path.join(backup_dir, 'wal', 'node')
|
||||
wals = [f for f in os.listdir(wals_dir) if os.path.isfile(os.path.join(
|
||||
wals_dir, f)) and not f.endswith('.backup')]
|
||||
wals_dir, f)) and not f.endswith('.backup') and not f.endswith('.partial')]
|
||||
wals = map(str, wals)
|
||||
file = os.path.join(wals_dir, max(wals))
|
||||
os.remove(file)
|
||||
@ -701,8 +701,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
# Single-thread PAGE backup
|
||||
try:
|
||||
self.backup_node(
|
||||
backup_dir, 'node', node,
|
||||
backup_type='page')
|
||||
backup_dir, 'node', node, backup_type='page')
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segment disappearance.\n "
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
import unittest
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
|
||||
from datetime import datetime, timedelta
|
||||
import subprocess
|
||||
from testgres import QueryException
|
||||
@ -236,9 +236,7 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
|
||||
gdb = self.gdb_attach(pid)
|
||||
gdb.set_breakpoint('reform_and_rewrite_tuple')
|
||||
|
||||
if not gdb.continue_execution_until_running():
|
||||
print('Failed gdb continue')
|
||||
exit(1)
|
||||
gdb.continue_execution_until_running()
|
||||
|
||||
acurs.execute("VACUUM FULL t_heap")
|
||||
|
||||
|
@ -1174,8 +1174,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir, 'node', node_restored,
|
||||
options=[
|
||||
"-j", "4", '--time={0}'.format(recovery_time),
|
||||
"--recovery-target-action=promote"
|
||||
]
|
||||
"--recovery-target-action=promote"]
|
||||
),
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(self.output), self.cmd))
|
||||
@ -1184,6 +1183,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
pgdata_restored = self.pgdata_content(node_restored.data_dir)
|
||||
self.compare_pgdata(pgdata, pgdata_restored)
|
||||
|
||||
node_restored.append_conf(
|
||||
"postgresql.auto.conf", "port = {0}".format(node_restored.port))
|
||||
|
||||
node_restored.slow_start()
|
||||
|
||||
result = node_restored.psql("postgres", 'select * from t_heap')
|
||||
|
Loading…
x
Reference in New Issue
Block a user