Skip to content

Commit 0ba73d3

Browse files
committed
tests: cfs tests skip condition added
1 parent b001128 commit 0ba73d3

File tree

2 files changed

+39
-19
lines changed

2 files changed

+39
-19
lines changed

tests/cfs_backup.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
class CfsBackupNoEncTest(ProbackupTest, unittest.TestCase):
1414
# --- Begin --- #
15+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
1516
def setUp(self):
1617
self.fname = self.id().split('.')[3]
1718
self.backup_dir = os.path.join(self.tmp_path, module_name, self.fname, 'backup')
18-
1919
self.node = self.make_simple_node(
2020
base_dir="{0}/{1}/node".format(module_name, self.fname),
2121
set_replication=True,
@@ -54,10 +54,9 @@ def setUp(self):
5454
# --- Section: Full --- #
5555
# @unittest.expectedFailure
5656
# @unittest.skip("skip")
57+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
5758
def test_fullbackup_empty_tablespace(self):
58-
"""
59-
Case: Check fullbackup empty compressed tablespace
60-
"""
59+
"""Case: Check fullbackup empty compressed tablespace"""
6160

6261
backup_id = None
6362
try:
@@ -82,10 +81,9 @@ def test_fullbackup_empty_tablespace(self):
8281

8382
# @unittest.expectedFailure
8483
# @unittest.skip("skip")
84+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
8585
def test_fullbackup_empty_tablespace_stream(self):
86-
"""
87-
Case: Check fullbackup empty compressed tablespace with options stream
88-
"""
86+
"""Case: Check fullbackup empty compressed tablespace with options stream"""
8987

9088
backup_id = None
9189
try:
@@ -111,11 +109,12 @@ def test_fullbackup_empty_tablespace_stream(self):
111109

112110
# @unittest.expectedFailure
113111
# @unittest.skip("skip")
112+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
114113
# PGPRO-1018 invalid file size
115114
def test_fullbackup_after_create_table(self):
116-
"""
117-
Case: Make full backup after created table in the tablespace
118-
"""
115+
"""Case: Make full backup after created table in the tablespace"""
116+
if not self.enterprise:
117+
return
119118

120119
self.node.safe_psql(
121120
"postgres",
@@ -153,6 +152,7 @@ def test_fullbackup_after_create_table(self):
153152

154153
# @unittest.expectedFailure
155154
# @unittest.skip("skip")
155+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
156156
# PGPRO-1018 invalid file size
157157
def test_fullbackup_after_create_table_stream(self):
158158
"""
@@ -195,6 +195,7 @@ def test_fullbackup_after_create_table_stream(self):
195195
# --- Section: Incremental from empty tablespace --- #
196196
# @unittest.expectedFailure
197197
# @unittest.skip("skip")
198+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
198199
def test_fullbackup_empty_tablespace_ptrack_after_create_table(self):
199200
"""
200201
Case: Make full backup before created table in the tablespace.
@@ -246,6 +247,7 @@ def test_fullbackup_empty_tablespace_ptrack_after_create_table(self):
246247

247248
# @unittest.expectedFailure
248249
# @unittest.skip("skip")
250+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
249251
def test_fullbackup_empty_tablespace_ptrack_after_create_table_stream(self):
250252
"""
251253
Case: Make full backup before created table in the tablespace.
@@ -301,6 +303,7 @@ def test_fullbackup_empty_tablespace_ptrack_after_create_table_stream(self):
301303

302304
# @unittest.expectedFailure
303305
# @unittest.skip("skip")
306+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
304307
def test_fullbackup_empty_tablespace_page_after_create_table(self):
305308
"""
306309
Case: Make full backup before created table in the tablespace.
@@ -352,6 +355,7 @@ def test_fullbackup_empty_tablespace_page_after_create_table(self):
352355

353356
# @unittest.expectedFailure
354357
# @unittest.skip("skip")
358+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
355359
def test_fullbackup_empty_tablespace_page_after_create_table_stream(self):
356360
"""
357361
Case: Make full backup before created table in the tablespace.
@@ -408,6 +412,7 @@ def test_fullbackup_empty_tablespace_page_after_create_table_stream(self):
408412
# --- Section: Incremental from fill tablespace --- #
409413
# @unittest.expectedFailure
410414
# @unittest.skip("skip")
415+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
411416
def test_fullbackup_after_create_table_ptrack_after_create_table(self):
412417
"""
413418
Case: Make full backup before created table in the tablespace.
@@ -466,6 +471,7 @@ def test_fullbackup_after_create_table_ptrack_after_create_table(self):
466471

467472
# @unittest.expectedFailure
468473
# @unittest.skip("skip")
474+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
469475
def test_fullbackup_after_create_table_ptrack_after_create_table_stream(self):
470476
"""
471477
Case: Make full backup before created table in the tablespace(--stream).
@@ -524,6 +530,7 @@ def test_fullbackup_after_create_table_ptrack_after_create_table_stream(self):
524530

525531
# @unittest.expectedFailure
526532
# @unittest.skip("skip")
533+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
527534
def test_fullbackup_after_create_table_page_after_create_table(self):
528535
"""
529536
Case: Make full backup before created table in the tablespace.
@@ -582,6 +589,7 @@ def test_fullbackup_after_create_table_page_after_create_table(self):
582589

583590
# @unittest.expectedFailure
584591
# @unittest.skip("skip")
592+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
585593
def test_multiple_segments(self):
586594
"""
587595
Case: Make full backup before created table in the tablespace.
@@ -659,6 +667,7 @@ def test_multiple_segments(self):
659667

660668
# @unittest.expectedFailure
661669
# @unittest.skip("skip")
670+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
662671
def test_multiple_segments_in_multiple_tablespaces(self):
663672
"""
664673
Case: Make full backup before created table in the tablespace.
@@ -765,6 +774,7 @@ def test_multiple_segments_in_multiple_tablespaces(self):
765774

766775
# @unittest.expectedFailure
767776
# @unittest.skip("skip")
777+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
768778
def test_fullbackup_after_create_table_page_after_create_table_stream(self):
769779
"""
770780
Case: Make full backup before created table in the tablespace(--stream).
@@ -824,6 +834,7 @@ def test_fullbackup_after_create_table_page_after_create_table_stream(self):
824834
# --- Make backup with not valid data(broken .cfm) --- #
825835
# @unittest.expectedFailure
826836
# @unittest.skip("skip")
837+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
827838
def test_delete_random_cfm_file_from_tablespace_dir(self):
828839
self.node.safe_psql(
829840
"postgres",
@@ -848,6 +859,7 @@ def test_delete_random_cfm_file_from_tablespace_dir(self):
848859

849860
# @unittest.expectedFailure
850861
# @unittest.skip("skip")
862+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
851863
def test_delete_file_pg_compression_from_tablespace_dir(self):
852864
os.remove(find_by_name([self.get_tblspace_path(self.node, tblspace_name)], ['pg_compression'])[0])
853865

@@ -858,6 +870,7 @@ def test_delete_file_pg_compression_from_tablespace_dir(self):
858870

859871
# @unittest.expectedFailure
860872
# @unittest.skip("skip")
873+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
861874
def test_delete_random_data_file_from_tablespace_dir(self):
862875
self.node.safe_psql(
863876
"postgres",
@@ -882,6 +895,7 @@ def test_delete_random_data_file_from_tablespace_dir(self):
882895

883896
# @unittest.expectedFailure
884897
# @unittest.skip("skip")
898+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
885899
def test_broken_random_cfm_file_into_tablespace_dir(self):
886900
self.node.safe_psql(
887901
"postgres",
@@ -906,6 +920,7 @@ def test_broken_random_cfm_file_into_tablespace_dir(self):
906920

907921
# @unittest.expectedFailure
908922
# @unittest.skip("skip")
923+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
909924
def test_broken_random_data_file_into_tablespace_dir(self):
910925
self.node.safe_psql(
911926
"postgres",
@@ -930,6 +945,7 @@ def test_broken_random_data_file_into_tablespace_dir(self):
930945

931946
# @unittest.expectedFailure
932947
# @unittest.skip("skip")
948+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
933949
def test_broken_file_pg_compression_into_tablespace_dir(self):
934950

935951
corrupted_file = find_by_name([self.get_tblspace_path(self.node, tblspace_name)], ['pg_compression'])[0]
@@ -945,6 +961,7 @@ def test_broken_file_pg_compression_into_tablespace_dir(self):
945961
)
946962

947963
# --- End ---#
964+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
948965
def tearDown(self):
949966
self.node.cleanup()
950967
self.del_test_dir(module_name, self.fname)

tests/helpers/ptrack_helpers.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,19 @@ def dir_files(base_dir):
9191
out_list.sort()
9292
return out_list
9393

94+
def is_enterprise():
95+
# pg_config --help
96+
p = subprocess.Popen([os.environ['PG_CONFIG'], '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
97+
if 'postgrespro.ru' in p.communicate()[0]:
98+
return True
99+
else:
100+
return False
101+
102+
94103
class ProbackupTest(object):
104+
# Class attributes
105+
enterprise = is_enterprise()
106+
95107
def __init__(self, *args, **kwargs):
96108
super(ProbackupTest, self).__init__(*args, **kwargs)
97109
if '-v' in argv or '--verbose' in argv:
@@ -222,8 +234,6 @@ def get_md5_per_page_for_fork(self, file, size_in_pages):
222234
nsegments = size_in_pages/131072
223235
if size_in_pages%131072 != 0:
224236
nsegments = nsegments + 1
225-
#print("Size: {0}".format(size_in_pages))
226-
#print("Number of segments: {0}".format(nsegments))
227237

228238
size = size_in_pages
229239
for segment_number in range(nsegments):
@@ -233,12 +243,8 @@ def get_md5_per_page_for_fork(self, file, size_in_pages):
233243
pages_per_segment[segment_number] = size
234244
size = size-131072
235245

236-
#print(pages_per_segment)
237-
238246
for segment_number in range(nsegments):
239247
offset = 0
240-
# print("Segno: {0}".format(segment_number))
241-
# print("Number of pages: {0}".format(pages_per_segment[segment_number]))
242248
if segment_number == 0:
243249
file_desc = os.open(file, os.O_RDONLY)
244250
start_page = 0
@@ -248,15 +254,12 @@ def get_md5_per_page_for_fork(self, file, size_in_pages):
248254
start_page = max(md5_per_page)+1
249255
end_page = end_page + pages_per_segment[segment_number]
250256

251-
# print('Start Page: {0}'.format(start_page))
252257
for page in range(start_page, end_page):
253258
md5_per_page[page] = hashlib.md5(os.read(file_desc, 8192)).hexdigest()
254259
offset += 8192
255260
os.lseek(file_desc, offset, 0)
256-
# print('End Page: {0}'.format(max(md5_per_page)))
257261
os.close(file_desc)
258262

259-
#print("Total Size: {0}".format(len(md5_per_page)))
260263
return md5_per_page
261264

262265
def get_ptrack_bits_per_page_for_fork(self, node, file, size=[]):

0 commit comments

Comments
 (0)