1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-03-22 21:51:29 +02:00

tests: minor fixes

This commit is contained in:
Grigory Smolkin 2019-05-29 18:49:38 +03:00
parent 0fa0ec2d8c
commit 2d7e60f9b1
2 changed files with 34 additions and 22 deletions

View File

@ -176,7 +176,7 @@ class MergeTest(ProbackupTest, unittest.TestCase):
# Initialize instance and backup directory # Initialize instance and backup directory
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'),
initdb_params=["--data-checksums"], set_replication=True, initdb_params=["--data-checksums"],
pg_options={ pg_options={
'autovacuum': 'off' 'autovacuum': 'off'
} }
@ -253,7 +253,7 @@ class MergeTest(ProbackupTest, unittest.TestCase):
# Initialize instance and backup directory # Initialize instance and backup directory
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'),
initdb_params=["--data-checksums"], set_replication=True, initdb_params=["--data-checksums"],
pg_options={ pg_options={
'autovacuum': 'off' 'autovacuum': 'off'
} }
@ -329,7 +329,7 @@ class MergeTest(ProbackupTest, unittest.TestCase):
# Initialize instance and backup directory # Initialize instance and backup directory
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'),
initdb_params=["--data-checksums"], set_replication=True, initdb_params=["--data-checksums"],
pg_options={ pg_options={
'autovacuum': 'off' 'autovacuum': 'off'
} }
@ -406,7 +406,7 @@ class MergeTest(ProbackupTest, unittest.TestCase):
# Initialize instance and backup directory # Initialize instance and backup directory
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'),
initdb_params=["--data-checksums"], set_replication=True, initdb_params=["--data-checksums"],
pg_options={ pg_options={
'autovacuum': 'off' 'autovacuum': 'off'
} }
@ -1734,14 +1734,22 @@ class MergeTest(ProbackupTest, unittest.TestCase):
backup_dir, 'backups', 'node', backup_dir, 'backups', 'node',
full_id, 'database', 'base', dboid) full_id, 'database', 'base', dboid)
self.merge_backup( try:
backup_dir, 'node', page_id_2, self.merge_backup(
options=['--log-level-console=verbose']) backup_dir, 'node', page_id_2,
options=['--log-level-console=verbose'])
#self.assertFalse( self.assertEqual(
# os.path.isdir(db_path), 1, 0,
# 'Directory {0} should not exist'.format( "Expecting Error because of missing parent.\n "
# db_path, full_id)) "Output: {0} \n CMD: {1}".format(
repr(self.output), self.cmd))
except ProbackupException as e:
self.assertTrue(
"ERROR: Parent full backup for the given "
"backup {0} was not found".format(
page_id_2) in e.message,
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
repr(e.message), self.cmd))
self.del_test_dir(module_name, fname) self.del_test_dir(module_name, fname)
@ -1798,22 +1806,26 @@ class MergeTest(ProbackupTest, unittest.TestCase):
gdb.set_breakpoint('pgFileDelete') gdb.set_breakpoint('pgFileDelete')
gdb.continue_execution_until_break(30) gdb.continue_execution_until_break(30)
gdb._execute('signal SIGKILL') gdb._execute('signal SIGKILL')
# backup half-merged
#self.assertEqual(
# 'MERGING', self.show_pb(backup_dir, 'node')[0]['status'])
self.assertEqual( self.assertEqual(
full_id, self.show_pb(backup_dir, 'node')[0]['id']) full_id, self.show_pb(backup_dir, 'node')[0]['id'])
# restore # restore
node.cleanup() node.cleanup()
self.restore_node(backup_dir, 'node', node) try:
self.restore_node(backup_dir, 'node', node)
pgdata_restored = self.pgdata_content(node.data_dir) self.assertEqual(
self.compare_pgdata(pgdata, pgdata_restored) 1, 0,
"Expecting Error because of orphan status.\n "
"Output: {0} \n CMD: {1}".format(
repr(self.output), self.cmd))
except ProbackupException as e:
self.assertIn(
"ERROR: Backup {0} is orphan".format(page_1),
e.message,
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
repr(e.message), self.cmd))
self.del_test_dir(module_name, fname) self.del_test_dir(module_name, fname)

View File

@ -26,7 +26,7 @@ class BugTest(ProbackupTest, unittest.TestCase):
# 'checkpoint_timeout': '60min', # 'checkpoint_timeout': '60min',
'checkpoint_completion_target': '0.9', 'checkpoint_completion_target': '0.9',
'bgwriter_delay': '10ms', 'bgwriter_delay': '10ms',
'bgwriter_lru_maxpages': '2000', 'bgwriter_lru_maxpages': '1000',
'bgwriter_lru_multiplier': '4.0', 'bgwriter_lru_multiplier': '4.0',
'max_wal_size': '256MB'}) 'max_wal_size': '256MB'})