You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-09-16 09:26:30 +02:00
tests: cfs tests skip condition added
This commit is contained in:
@@ -12,10 +12,10 @@ tblspace_name = 'cfs_tblspace'
|
||||
|
||||
class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
# --- Begin --- #
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def setUp(self):
|
||||
self.fname = self.id().split('.')[3]
|
||||
self.backup_dir = os.path.join(self.tmp_path, module_name, self.fname, 'backup')
|
||||
|
||||
self.node = self.make_simple_node(
|
||||
base_dir="{0}/{1}/node".format(module_name, self.fname),
|
||||
set_replication=True,
|
||||
@@ -54,10 +54,9 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
# --- Section: Full --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace(self):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace
|
||||
"""
|
||||
"""Case: Check fullbackup empty compressed tablespace"""
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
@@ -82,10 +81,9 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace_stream(self):
|
||||
"""
|
||||
Case: Check fullbackup empty compressed tablespace with options stream
|
||||
"""
|
||||
"""Case: Check fullbackup empty compressed tablespace with options stream"""
|
||||
|
||||
backup_id = None
|
||||
try:
|
||||
@@ -111,11 +109,12 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
# PGPRO-1018 invalid file size
|
||||
def test_fullbackup_after_create_table(self):
|
||||
"""
|
||||
Case: Make full backup after created table in the tablespace
|
||||
"""
|
||||
"""Case: Make full backup after created table in the tablespace"""
|
||||
if not self.enterprise:
|
||||
return
|
||||
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
@@ -153,6 +152,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
# PGPRO-1018 invalid file size
|
||||
def test_fullbackup_after_create_table_stream(self):
|
||||
"""
|
||||
@@ -195,6 +195,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
# --- Section: Incremental from empty tablespace --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace_ptrack_after_create_table(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -246,6 +247,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace_ptrack_after_create_table_stream(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -301,6 +303,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace_page_after_create_table(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -352,6 +355,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_empty_tablespace_page_after_create_table_stream(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -408,6 +412,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
# --- Section: Incremental from fill tablespace --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_after_create_table_ptrack_after_create_table(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -466,6 +471,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_after_create_table_ptrack_after_create_table_stream(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace(--stream).
|
||||
@@ -524,6 +530,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_after_create_table_page_after_create_table(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -582,6 +589,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_multiple_segments(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -659,6 +667,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_multiple_segments_in_multiple_tablespaces(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace.
|
||||
@@ -765,6 +774,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_fullbackup_after_create_table_page_after_create_table_stream(self):
|
||||
"""
|
||||
Case: Make full backup before created table in the tablespace(--stream).
|
||||
@@ -824,6 +834,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
# --- Make backup with not valid data(broken .cfm) --- #
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_delete_random_cfm_file_from_tablespace_dir(self):
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
@@ -848,6 +859,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_delete_file_pg_compression_from_tablespace_dir(self):
|
||||
os.remove(find_by_name([self.get_tblspace_path(self.node, tblspace_name)], ['pg_compression'])[0])
|
||||
|
||||
@@ -858,6 +870,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_delete_random_data_file_from_tablespace_dir(self):
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
@@ -882,6 +895,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_broken_random_cfm_file_into_tablespace_dir(self):
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
@@ -906,6 +920,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_broken_random_data_file_into_tablespace_dir(self):
|
||||
self.node.safe_psql(
|
||||
"postgres",
|
||||
@@ -930,6 +945,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# @unittest.expectedFailure
|
||||
# @unittest.skip("skip")
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def test_broken_file_pg_compression_into_tablespace_dir(self):
|
||||
|
||||
corrupted_file = find_by_name([self.get_tblspace_path(self.node, tblspace_name)], ['pg_compression'])[0]
|
||||
@@ -945,6 +961,7 @@ class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
|
||||
)
|
||||
|
||||
# --- End ---#
|
||||
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
|
||||
def tearDown(self):
|
||||
self.node.cleanup()
|
||||
self.del_test_dir(module_name, self.fname)
|
||||
|
@@ -91,7 +91,19 @@ def dir_files(base_dir):
|
||||
out_list.sort()
|
||||
return out_list
|
||||
|
||||
def is_enterprise():
|
||||
# pg_config --help
|
||||
p = subprocess.Popen([os.environ['PG_CONFIG'], '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if 'postgrespro.ru' in p.communicate()[0]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class ProbackupTest(object):
|
||||
# Class attributes
|
||||
enterprise = is_enterprise()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ProbackupTest, self).__init__(*args, **kwargs)
|
||||
if '-v' in argv or '--verbose' in argv:
|
||||
@@ -222,8 +234,6 @@ class ProbackupTest(object):
|
||||
nsegments = size_in_pages/131072
|
||||
if size_in_pages%131072 != 0:
|
||||
nsegments = nsegments + 1
|
||||
#print("Size: {0}".format(size_in_pages))
|
||||
#print("Number of segments: {0}".format(nsegments))
|
||||
|
||||
size = size_in_pages
|
||||
for segment_number in range(nsegments):
|
||||
@@ -233,12 +243,8 @@ class ProbackupTest(object):
|
||||
pages_per_segment[segment_number] = size
|
||||
size = size-131072
|
||||
|
||||
#print(pages_per_segment)
|
||||
|
||||
for segment_number in range(nsegments):
|
||||
offset = 0
|
||||
# print("Segno: {0}".format(segment_number))
|
||||
# print("Number of pages: {0}".format(pages_per_segment[segment_number]))
|
||||
if segment_number == 0:
|
||||
file_desc = os.open(file, os.O_RDONLY)
|
||||
start_page = 0
|
||||
@@ -248,15 +254,12 @@ class ProbackupTest(object):
|
||||
start_page = max(md5_per_page)+1
|
||||
end_page = end_page + pages_per_segment[segment_number]
|
||||
|
||||
# print('Start Page: {0}'.format(start_page))
|
||||
for page in range(start_page, end_page):
|
||||
md5_per_page[page] = hashlib.md5(os.read(file_desc, 8192)).hexdigest()
|
||||
offset += 8192
|
||||
os.lseek(file_desc, offset, 0)
|
||||
# print('End Page: {0}'.format(max(md5_per_page)))
|
||||
os.close(file_desc)
|
||||
|
||||
#print("Total Size: {0}".format(len(md5_per_page)))
|
||||
return md5_per_page
|
||||
|
||||
def get_ptrack_bits_per_page_for_fork(self, node, file, size=[]):
|
||||
|
Reference in New Issue
Block a user