Skip to content

Commit b17669c

Browse files
committed
[PBCKP-146] add test for "unchanged cfm is not backuped"
1 parent 7cadc33 commit b17669c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/cfs_backup.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,69 @@ def test_fullbackup_empty_tablespace_page_after_create_table(self):
419419
"ERROR: .cfm files not found in backup dir"
420420
)
421421

422+
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')
423+
def test_page_doesnt_store_unchanged_cfm(self):
424+
"""
425+
Case: Test page backup doesn't store cfm file if table were not modified
426+
"""
427+
428+
self.node.safe_psql(
429+
"postgres",
430+
"CREATE TABLE {0} TABLESPACE {1} "
431+
"AS SELECT i AS id, MD5(i::text) AS text, "
432+
"MD5(repeat(i::text,10))::tsvector AS tsvector "
433+
"FROM generate_series(0,256) i".format('t1', tblspace_name)
434+
)
435+
436+
try:
437+
backup_id_full = self.backup_node(
438+
self.backup_dir, 'node', self.node, backup_type='full')
439+
except ProbackupException as e:
440+
self.fail(
441+
"ERROR: Full backup failed.\n {0} \n {1}".format(
442+
repr(self.cmd),
443+
repr(e.message)
444+
)
445+
)
446+
447+
self.assertTrue(
448+
find_by_extensions(
449+
[os.path.join(self.backup_dir, 'backups', 'node', backup_id_full)],
450+
['.cfm']),
451+
"ERROR: .cfm files not found in backup dir"
452+
)
453+
454+
try:
455+
backup_id = self.backup_node(
456+
self.backup_dir, 'node', self.node, backup_type='page')
457+
except ProbackupException as e:
458+
self.fail(
459+
"ERROR: Incremental backup failed.\n {0} \n {1}".format(
460+
repr(self.cmd),
461+
repr(e.message)
462+
)
463+
)
464+
465+
show_backup = self.show_pb(self.backup_dir, 'node', backup_id)
466+
self.assertEqual(
467+
"OK",
468+
show_backup["status"],
469+
"ERROR: Incremental backup status is not valid. \n "
470+
"Current backup status={0}".format(show_backup["status"])
471+
)
472+
self.assertTrue(
473+
find_by_name(
474+
[self.get_tblspace_path(self.node, tblspace_name)],
475+
['pg_compression']),
476+
"ERROR: File pg_compression not found"
477+
)
478+
self.assertFalse(
479+
find_by_extensions(
480+
[os.path.join(self.backup_dir, 'backups', 'node', backup_id)],
481+
['.cfm']),
482+
"ERROR: .cfm files is found in backup dir"
483+
)
484+
422485
# @unittest.expectedFailure
423486
# @unittest.skip("skip")
424487
@unittest.skipUnless(ProbackupTest.enterprise, 'skip')

0 commit comments

Comments
 (0)