Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit535e417

Browse files
committed
tests: added retention.RetentionTest.test_agressive_retention_window_purge
1 parent5cb84f2 commit535e417

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

‎tests/retention.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importos
22
importunittest
33
fromdatetimeimportdatetime,timedelta
4-
from .helpers.ptrack_helpersimportProbackupTest
4+
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
55
fromtimeimportsleep
66

77

@@ -1459,3 +1459,49 @@ def test_retention_redundancy_overlapping_chains(self):
14591459

14601460
# Clean after yourself
14611461
self.del_test_dir(module_name,fname)
1462+
1463+
deftest_agressive_retention_window_purge(self):
1464+
"""
1465+
https://github.com/postgrespro/pg_probackup/issues/106
1466+
"""
1467+
fname=self.id().split('.')[3]
1468+
node=self.make_simple_node(
1469+
base_dir=os.path.join(module_name,fname,'node'),
1470+
initdb_params=['--data-checksums'])
1471+
1472+
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
1473+
self.init_pb(backup_dir)
1474+
self.add_instance(backup_dir,'node',node)
1475+
node.slow_start()
1476+
1477+
# Make ERROR incremental backup
1478+
try:
1479+
self.backup_node(backup_dir,'node',node,backup_type='page')
1480+
# we should die here because exception is what we expect to happen
1481+
self.assertEqual(
1482+
1,0,
1483+
"Expecting Error because page backup should not be possible "
1484+
"without valid full backup.\n Output: {0}\n CMD: {1}".format(
1485+
repr(self.output),self.cmd))
1486+
exceptProbackupExceptionase:
1487+
self.assertIn(
1488+
"ERROR: Valid backup on current timeline 1 is not found. "
1489+
"Create new FULL backup before an incremental one.",
1490+
e.message,
1491+
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
1492+
repr(e.message),self.cmd))
1493+
1494+
page_id=self.show_pb(backup_dir,'node')[0]['id']
1495+
1496+
sleep(1)
1497+
1498+
# Make FULL backup
1499+
self.backup_node(
1500+
backup_dir,'node',node,
1501+
options=['--delete-expired','--retention-window=1','--stream'])
1502+
1503+
# Check number of backups
1504+
self.assertEqual(len(self.show_pb(backup_dir,'node')),2)
1505+
1506+
# Clean after yourself
1507+
self.del_test_dir(module_name,fname)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp