mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-04-25 13:24:42 +02:00
tests: add property pg_config_version
This commit is contained in:
parent
420a527a65
commit
64d0443057
@ -1050,6 +1050,9 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
# @unittest.skip("skip")
|
# @unittest.skip("skip")
|
||||||
def test_pg_11_adjusted_wal_segment_size(self):
|
def test_pg_11_adjusted_wal_segment_size(self):
|
||||||
""""""
|
""""""
|
||||||
|
if self.pg_config_version < self.version_to_num('11.0'):
|
||||||
|
return unittest.skip('You need PostgreSQL >= 11 for this test')
|
||||||
|
|
||||||
fname = self.id().split('.')[3]
|
fname = self.id().split('.')[3]
|
||||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||||
node = self.make_simple_node(
|
node = self.make_simple_node(
|
||||||
@ -1067,9 +1070,6 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.set_archiving(backup_dir, 'node', node)
|
self.set_archiving(backup_dir, 'node', node)
|
||||||
node.slow_start()
|
node.slow_start()
|
||||||
|
|
||||||
if self.get_version(node) < self.version_to_num('11.0'):
|
|
||||||
return unittest.skip('You need PostgreSQL >= 11 for this test')
|
|
||||||
|
|
||||||
node.pgbench_init(scale=5)
|
node.pgbench_init(scale=5)
|
||||||
|
|
||||||
# FULL STREAM backup
|
# FULL STREAM backup
|
||||||
@ -1119,8 +1119,6 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
|||||||
'--delete-wal',
|
'--delete-wal',
|
||||||
'--retention-redundancy=1'])
|
'--retention-redundancy=1'])
|
||||||
|
|
||||||
print(output)
|
|
||||||
|
|
||||||
# validate
|
# validate
|
||||||
self.validate_pb(backup_dir)
|
self.validate_pb(backup_dir)
|
||||||
|
|
||||||
|
@ -466,11 +466,6 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
|
|||||||
"postgres",
|
"postgres",
|
||||||
"create extension amcheck_next")
|
"create extension amcheck_next")
|
||||||
|
|
||||||
# truncate log_file
|
|
||||||
#with open(node.pg_log_file, 'w') as f:
|
|
||||||
# f.truncate()
|
|
||||||
# f.close()
|
|
||||||
|
|
||||||
# FULL backup
|
# FULL backup
|
||||||
gdb = self.checkdb_node(
|
gdb = self.checkdb_node(
|
||||||
backup_dir, 'node', gdb=True,
|
backup_dir, 'node', gdb=True,
|
||||||
@ -482,7 +477,7 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
|
|||||||
gdb.set_breakpoint('amcheck_one_index')
|
gdb.set_breakpoint('amcheck_one_index')
|
||||||
gdb.run_until_break()
|
gdb.run_until_break()
|
||||||
|
|
||||||
gdb.continue_execution_until_break(4)
|
gdb.continue_execution_until_break(10)
|
||||||
gdb.remove_all_breakpoints()
|
gdb.remove_all_breakpoints()
|
||||||
|
|
||||||
gdb._execute('signal SIGINT')
|
gdb._execute('signal SIGINT')
|
||||||
|
@ -928,8 +928,6 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
|
|||||||
set_replication=True,
|
set_replication=True,
|
||||||
initdb_params=['--data-checksums'],
|
initdb_params=['--data-checksums'],
|
||||||
pg_options={
|
pg_options={
|
||||||
'max_wal_senders': '2',
|
|
||||||
'checkpoint_timeout': '30s',
|
|
||||||
'autovacuum': 'off'
|
'autovacuum': 'off'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -274,6 +274,11 @@ class ProbackupTest(object):
|
|||||||
if 'PGPROBACKUP_SSH_REMOTE' in self.test_env:
|
if 'PGPROBACKUP_SSH_REMOTE' in self.test_env:
|
||||||
self.remote = True
|
self.remote = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pg_config_version(self):
|
||||||
|
return self.version_to_num(
|
||||||
|
testgres.get_pg_config()['VERSION'].split(" ")[1])
|
||||||
|
|
||||||
# if 'PGPROBACKUP_SSH_HOST' in self.test_env:
|
# if 'PGPROBACKUP_SSH_HOST' in self.test_env:
|
||||||
# self.remote_host = self.test_env['PGPROBACKUP_SSH_HOST']
|
# self.remote_host = self.test_env['PGPROBACKUP_SSH_HOST']
|
||||||
# else
|
# else
|
||||||
|
@ -2159,6 +2159,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
test group access for PG >= 11
|
test group access for PG >= 11
|
||||||
"""
|
"""
|
||||||
|
if self.pg_config_version < self.version_to_num('11.0'):
|
||||||
|
return unittest.skip('You need PostgreSQL >= 11 for this test')
|
||||||
|
|
||||||
fname = self.id().split('.')[3]
|
fname = self.id().split('.')[3]
|
||||||
node = self.make_simple_node(
|
node = self.make_simple_node(
|
||||||
base_dir=os.path.join(module_name, fname, 'node'),
|
base_dir=os.path.join(module_name, fname, 'node'),
|
||||||
@ -2172,9 +2175,6 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.add_instance(backup_dir, 'node', node)
|
self.add_instance(backup_dir, 'node', node)
|
||||||
node.slow_start()
|
node.slow_start()
|
||||||
|
|
||||||
if self.get_version(node) < self.version_to_num('11.0'):
|
|
||||||
return unittest.skip('You need PostgreSQL >= 11 for this test')
|
|
||||||
|
|
||||||
# take FULL backup
|
# take FULL backup
|
||||||
self.backup_node(backup_dir, 'node', node, options=['--stream'])
|
self.backup_node(backup_dir, 'node', node, options=['--stream'])
|
||||||
|
|
||||||
@ -2200,6 +2200,9 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
test group access for PG >= 11
|
test group access for PG >= 11
|
||||||
"""
|
"""
|
||||||
|
if self.pg_config_version < self.version_to_num('10.0'):
|
||||||
|
return unittest.skip('You need PostgreSQL >= 10 for this test')
|
||||||
|
|
||||||
fname = self.id().split('.')[3]
|
fname = self.id().split('.')[3]
|
||||||
wal_dir = os.path.join(
|
wal_dir = os.path.join(
|
||||||
os.path.join(self.tmp_path, module_name, fname), 'wal_dir')
|
os.path.join(self.tmp_path, module_name, fname), 'wal_dir')
|
||||||
@ -2216,9 +2219,6 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.add_instance(backup_dir, 'node', node)
|
self.add_instance(backup_dir, 'node', node)
|
||||||
node.slow_start()
|
node.slow_start()
|
||||||
|
|
||||||
if self.get_version(node) < self.version_to_num('10.0'):
|
|
||||||
return unittest.skip('You need PostgreSQL >= 10 for this test')
|
|
||||||
|
|
||||||
# take FULL backup
|
# take FULL backup
|
||||||
self.backup_node(
|
self.backup_node(
|
||||||
backup_dir, 'node', node, options=['--stream'])
|
backup_dir, 'node', node, options=['--stream'])
|
||||||
@ -2335,7 +2335,11 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
|||||||
self.output, self.cmd))
|
self.output, self.cmd))
|
||||||
except ProbackupException as e:
|
except ProbackupException as e:
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
'Insert correct error message', e.message,
|
'is not found', e.message,
|
||||||
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
|
repr(e.message), self.cmd))
|
||||||
|
self.assertIn(
|
||||||
|
'ERROR: Data files restoring failed', e.message,
|
||||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||||
repr(e.message), self.cmd))
|
repr(e.message), self.cmd))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user