mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
Add cfs_restore_noenc. Update cfs_backup_enc and cfs_backup_noenc
This commit is contained in:
parent
c4b382b0d5
commit
8400cf44c1
@ -7,7 +7,7 @@ from . import init_test, option_test, show_test, \
|
||||
ptrack_vacuum_bits_frozen, ptrack_vacuum_bits_visibility, \
|
||||
ptrack_vacuum_full, ptrack_vacuum_truncate, pgpro560, pgpro589, \
|
||||
false_positive, replica, compression, page, ptrack, archive, \
|
||||
cfs_backup_noenc, cfs_backup_enc
|
||||
cfs_backup_noenc, cfs_backup_enc, cfs_restore_noenc
|
||||
|
||||
|
||||
def load_tests(loader, tests, pattern):
|
||||
@ -39,6 +39,7 @@ def load_tests(loader, tests, pattern):
|
||||
suite.addTests(loader.loadTestsFromModule(archive))
|
||||
suite.addTests(loader.loadTestsFromModule(cfs_backup_noenc))
|
||||
suite.addTests(loader.loadTestsFromModule(cfs_backup_enc))
|
||||
suite.addTests(loader.loadTestsFromModule(cfs_restore_noenc))
|
||||
|
||||
return suite
|
||||
|
||||
|
@ -42,29 +42,17 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
node.start()
|
||||
|
||||
# --- Section: Prepare --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_create_tblspace_compression(self):
|
||||
"""
|
||||
Case: Check to create compression tablespace
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
tblspace = node.safe_psql(
|
||||
"postgres",
|
||||
"SELECT * FROM pg_tablespace WHERE spcname='{0}'".format(tblspace_name)
|
||||
)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'create table {0} tablespace {1} \
|
||||
as select i as id, md5(i::text) as text, \
|
||||
md5(repeat(i::text,10))::tsvector as tsvector \
|
||||
from generate_series(0,256) i'.format('t1', tblspace_name)
|
||||
)
|
||||
self.assertTrue(
|
||||
tblspace_name in tblspace and "compression=true" in tblspace,
|
||||
"ERROR: The tablespace not created or it create without compressions"
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node, tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found"
|
||||
@ -77,7 +65,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
@ -85,9 +72,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -107,7 +94,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace with options stream
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
@ -115,9 +101,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -143,8 +129,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Case: Make full backup after created table in the tablespace
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -159,9 +143,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {0}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {0}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -191,8 +175,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Case: Make full backup after created table in the tablespace with option --stream
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -205,11 +187,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -240,15 +221,14 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make ptrack backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -266,9 +246,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -298,15 +278,14 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make ptrack backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -324,9 +303,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -356,15 +335,14 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make page backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -382,9 +360,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -414,15 +392,14 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make page backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -440,9 +417,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -474,7 +451,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -489,9 +465,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -509,9 +485,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -535,7 +511,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -550,9 +525,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -570,9 +545,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -596,7 +571,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -611,9 +585,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -631,9 +605,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -657,7 +631,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -672,9 +645,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -692,9 +665,9 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -40,29 +40,17 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
node.start()
|
||||
|
||||
# --- Section: Prepare --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_create_tblspace_compression(self):
|
||||
"""
|
||||
Case: Check to create compression tablespace
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
tblspace = node.safe_psql(
|
||||
"postgres",
|
||||
"SELECT * FROM pg_tablespace WHERE spcname='{0}'".format(tblspace_name)
|
||||
)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'create table {0} tablespace {1} \
|
||||
as select i as id, md5(i::text) as text, \
|
||||
md5(repeat(i::text,10))::tsvector as tsvector \
|
||||
from generate_series(0,256) i'.format('t1', tblspace_name)
|
||||
)
|
||||
self.assertTrue(
|
||||
tblspace_name in tblspace and "compression=true" in tblspace,
|
||||
"ERROR: The tablespace not created or it create without compressions"
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node, tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found"
|
||||
@ -75,17 +63,15 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -105,17 +91,15 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace with options stream
|
||||
"""
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -141,8 +125,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Case: Make full backup after created table in the tablespace
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -155,11 +137,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {0}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {0}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -189,8 +170,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Case: Make full backup after created table in the tablespace with option --stream
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -203,11 +182,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -238,15 +216,13 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make ptrack backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -262,11 +238,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='ptrack')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -296,15 +271,13 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make ptrack backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -320,11 +293,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='ptrack', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -354,15 +326,13 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make page backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -378,11 +348,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='page')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -412,15 +381,13 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Make page backup after create table
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
try:
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -436,11 +403,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='page', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
show_backup = self.show_pb(backup_dir, 'node', backup_id)
|
||||
@ -472,7 +438,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -485,11 +450,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_full = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -505,11 +469,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_ptrack = self.backup_node(backup_dir, 'node', node, backup_type='ptrack')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -533,7 +496,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -546,11 +508,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_full = self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -566,11 +527,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_ptrack = self.backup_node(backup_dir, 'node', node, backup_type='ptrack', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -594,7 +554,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -607,11 +566,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_full = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -627,11 +585,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_page = self.backup_node(backup_dir, 'node', node, backup_type='page')
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -655,7 +612,6 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
Check: incremental backup will not greater as full
|
||||
"""
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
@ -668,11 +624,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_full = self.backup_node(backup_dir, 'node', node, backup_type='full', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Full backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Full backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -688,11 +643,10 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
backup_id_page = self.backup_node(backup_dir, 'node', node, backup_type='page', options=['--stream'])
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
False,
|
||||
"ERROR: Incremental backup wasn't created.\n {0} \n {1}".format(
|
||||
str(e.cmd),
|
||||
str(e.message)
|
||||
self.fail(
|
||||
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
@ -714,9 +668,14 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
# @unittest.skip("skip")
|
||||
def test_delete_file_pg_compression_from_tablespace_dir(self):
|
||||
pass
|
||||
os.remove(find_by_name([self.get_tblspace_path(node, tblspace_name)], ['pg_compression'])[0])
|
||||
|
||||
self.assertRaises(
|
||||
ProbackupException,
|
||||
self.backup_node,backup_dir, 'node', node, backup_type='full'
|
||||
)
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
@ -745,9 +704,20 @@ class CfsBackupEncTest(ProbackupTest, unittest.TestCase):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
# @unittest.skip("skip")
|
||||
def test_delete_file_pg_compression_from_backup_dir(self):
|
||||
pass
|
||||
self.backup_node(backup_dir, 'node', node, backup_type = 'full')
|
||||
show_backup = self.show_pb(backup_dir,'node')[0]
|
||||
|
||||
self.assertEqual(
|
||||
"OK",
|
||||
show_backup["Status"],
|
||||
"ERROR: Backup is not valid. \n Backup status: %s" % show_backup["Status"]
|
||||
)
|
||||
|
||||
os.remove(find_by_name([os.path.join(backup_dir, 'backups', 'node', show_backup["ID"])], ['pg_compression'])[0])
|
||||
|
||||
self.assertRaises(ProbackupException, self.validate_pb, backup_dir, 'node')
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
|
397
tests/cfs_restore_noenc.py
Normal file
397
tests/cfs_restore_noenc.py
Normal file
@ -0,0 +1,397 @@
|
||||
"""
|
||||
restore
|
||||
Syntax:
|
||||
|
||||
pg_probackup restore -B backupdir --instance instance_name
|
||||
[-D datadir]
|
||||
[ -i backup_id | [{--time=time | --xid=xid } [--inclusive=boolean]]][--timeline=timeline] [-T OLDDIR=NEWDIR]
|
||||
[-j num_threads] [--progress] [-q] [-v]
|
||||
|
||||
"""
|
||||
import os
|
||||
import unittest
|
||||
import shutil
|
||||
|
||||
from .helpers.cfs_helpers import find_by_extensions, find_by_name
|
||||
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
|
||||
|
||||
|
||||
module_name = 'cfs_restore_noenc'
|
||||
|
||||
tblspace_name = 'cfs_tblspace_noenc'
|
||||
tblspace_name_new = 'cfs_tblspace_new'
|
||||
|
||||
|
||||
class CfsRestoreNoencEmptyTablespaceTest(ProbackupTest, unittest.TestCase):
|
||||
fname = None
|
||||
backup_dir = None
|
||||
node = None
|
||||
|
||||
def setUp(self):
|
||||
global fname
|
||||
global backup_dir
|
||||
global node
|
||||
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
set_replication=True,
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={
|
||||
'wal_level': 'replica',
|
||||
'ptrack_enable': 'on',
|
||||
'cfs_encryption': 'off',
|
||||
'max_wal_senders': '2'
|
||||
}
|
||||
)
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
|
||||
node.start()
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
self.backup_id = None
|
||||
try:
|
||||
self.backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Full backup failed \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_restore_empty_tablespace_from_fullbackup(self):
|
||||
"""
|
||||
Case: Restore empty tablespace from valid full backup.
|
||||
"""
|
||||
node.stop({"-m": "immediate"})
|
||||
node.cleanup()
|
||||
shutil.rmtree(self.get_tblspace_path(node, tblspace_name))
|
||||
|
||||
try:
|
||||
self.restore_node(backup_dir, 'node', node, backup_id=self.backup_id)
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Restore failed. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node, tblspace_name)], ["pg_compression"]),
|
||||
"ERROR: Restored data is not valid. pg_compression not found in tablespace dir."
|
||||
)
|
||||
|
||||
try:
|
||||
node.start()
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
tblspace = node.safe_psql(
|
||||
"postgres",
|
||||
"SELECT * FROM pg_tablespace WHERE spcname='{0}'".format(tblspace_name)
|
||||
)
|
||||
self.assertTrue(
|
||||
tblspace_name in tblspace and "compression=true" in tblspace,
|
||||
"ERROR: The tablespace not restored or it restored without compressions"
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
node.cleanup()
|
||||
self.del_test_dir(module_name, fname)
|
||||
|
||||
|
||||
class CfsRestoreNoencTest(ProbackupTest, unittest.TestCase):
|
||||
fname = None
|
||||
backup_dir = None
|
||||
node = None
|
||||
|
||||
def setUp(self):
|
||||
global fname
|
||||
global backup_dir
|
||||
global node
|
||||
|
||||
fname = self.id().split('.')[3]
|
||||
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
|
||||
|
||||
node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, fname),
|
||||
set_replication=True,
|
||||
initdb_params=['--data-checksums'],
|
||||
pg_options={
|
||||
'wal_level': 'replica',
|
||||
'ptrack_enable': 'on',
|
||||
'cfs_encryption': 'off',
|
||||
'max_wal_senders': '2'
|
||||
}
|
||||
)
|
||||
|
||||
self.init_pb(backup_dir)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
self.set_archiving(backup_dir, 'node', node)
|
||||
|
||||
node.start()
|
||||
|
||||
self.create_tblspace_in_node(node, tblspace_name, True)
|
||||
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
'CREATE TABLE {0} TABLESPACE {1} \
|
||||
AS SELECT i AS id, MD5(i::text) AS text, \
|
||||
MD5(repeat(i::text,10))::tsvector AS tsvector \
|
||||
FROM generate_series(0,1e5) i'.format('t1', tblspace_name)
|
||||
)
|
||||
self.table_t1 = node.safe_psql(
|
||||
"postgres",
|
||||
"SELECT * FROM t1"
|
||||
)
|
||||
self.backup_id = None
|
||||
try:
|
||||
self.backup_id = self.backup_node(backup_dir, 'node', node, backup_type='full')
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Full backup failed \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
# --- Restore from full backup ---#
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_old_location(self):
|
||||
"""
|
||||
Case: Restore instance from valid full backup to old location.
|
||||
"""
|
||||
node.stop(['-m', 'immediate'])
|
||||
node.cleanup()
|
||||
shutil.rmtree(self.get_tblspace_path(node, tblspace_name))
|
||||
|
||||
try:
|
||||
self.restore_node(backup_dir, 'node', node, backup_id=self.backup_id)
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node, tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found in backup dir"
|
||||
)
|
||||
try:
|
||||
node.start()
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
repr(node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
|
||||
repr(self.table_t1)
|
||||
)
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_old_location_3_jobs(self):
|
||||
"""
|
||||
Case: Restore instance from valid full backup to old location.
|
||||
"""
|
||||
node.stop(['-m', 'immediate'])
|
||||
node.cleanup()
|
||||
shutil.rmtree(self.get_tblspace_path(node, tblspace_name))
|
||||
|
||||
try:
|
||||
self.restore_node(backup_dir, 'node', node, backup_id=self.backup_id, options=['-j', '3'])
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node,tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found in backup dir"
|
||||
)
|
||||
try:
|
||||
node.start()
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
repr(node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
|
||||
repr(self.table_t1)
|
||||
)
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_new_location(self):
|
||||
"""
|
||||
Case: Restore instance from valid full backup to new location.
|
||||
"""
|
||||
node.stop(['-m', 'immediate'])
|
||||
node.cleanup()
|
||||
shutil.rmtree(self.get_tblspace_path(node, tblspace_name))
|
||||
|
||||
node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, fname))
|
||||
|
||||
try:
|
||||
self.restore_node(backup_dir, 'node', node_new, backup_id=self.backup_id)
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node_new,tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found in backup dir"
|
||||
)
|
||||
try:
|
||||
node_new.start()
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
repr(node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
|
||||
repr(self.table_t1)
|
||||
)
|
||||
node_new.cleanup()
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_new_location_5_jobs(self):
|
||||
"""
|
||||
Case: Restore instance from valid full backup to new location.
|
||||
"""
|
||||
node.stop(['-m', 'immediate'])
|
||||
node.cleanup()
|
||||
shutil.rmtree(self.get_tblspace_path(node, tblspace_name))
|
||||
|
||||
node_new = self.make_simple_node(base_dir="{0}/{1}/node_new_location".format(module_name, fname))
|
||||
|
||||
try:
|
||||
self.restore_node(backup_dir, 'node', node_new, backup_id=self.backup_id, options=['-j', '5'])
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Restore from full backup failed. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
self.assertTrue(
|
||||
find_by_name([self.get_tblspace_path(node_new,tblspace_name)], ['pg_compression']),
|
||||
"ERROR: File pg_compression not found in backup dir"
|
||||
)
|
||||
try:
|
||||
node_new.start()
|
||||
except ProbackupException as e:
|
||||
self.fail(
|
||||
"ERROR: Instance not started after restore. \n {0} \n {1}".format(
|
||||
repr(self.cmd),
|
||||
repr(e.message)
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
repr(node.safe_psql("postgres", "SELECT * FROM %s" % 't1')),
|
||||
repr(self.table_t1)
|
||||
)
|
||||
node_new.cleanup()
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_old_location_tablespace_new_location(self):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_old_location_tablespace_new_location_3_jobs(self):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_new_location_tablespace_new_location(self):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_fullbackup_to_new_location_tablespace_new_location_5_jobs(self):
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_ptrack(self):
|
||||
"""
|
||||
Case: Restore from backup to old location
|
||||
"""
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_ptrack_jobs(self):
|
||||
"""
|
||||
Case: Restore from backup to old location, four jobs
|
||||
"""
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_ptrack_new_jobs(self):
|
||||
pass
|
||||
|
||||
# --------------------------------------------------------- #
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_page(self):
|
||||
"""
|
||||
Case: Restore from backup to old location
|
||||
"""
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_page_jobs(self):
|
||||
"""
|
||||
Case: Restore from backup to old location, four jobs
|
||||
"""
|
||||
pass
|
||||
|
||||
# @unittest.expectedFailure
|
||||
@unittest.skip("skip")
|
||||
def test_restore_from_page_new_jobs(self):
|
||||
"""
|
||||
Case: Restore from backup to new location, four jobs
|
||||
"""
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
node.cleanup()
|
||||
self.del_test_dir(module_name, fname)
|
Loading…
Reference in New Issue
Block a user