Skip to content

Commit c1ed6ff

Browse files
committed
[Issue #250] tests: added tests.merge.MergeTest.test_merge_remote_mode
1 parent 7b6b782 commit c1ed6ff

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/merge.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,5 +2772,62 @@ def test_missing_non_data_file(self):
27722772

27732773
self.del_test_dir(module_name, fname)
27742774

2775+
# @unittest.skip("skip")
2776+
def test_merge_remote_mode(self):
2777+
"""
2778+
"""
2779+
fname = self.id().split('.')[3]
2780+
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
2781+
node = self.make_simple_node(
2782+
base_dir=os.path.join(module_name, fname, 'node'),
2783+
set_replication=True,
2784+
initdb_params=['--data-checksums'],
2785+
pg_options={'autovacuum': 'off'})
2786+
2787+
self.init_pb(backup_dir)
2788+
self.add_instance(backup_dir, 'node', node)
2789+
self.set_archiving(backup_dir, 'node', node)
2790+
node.slow_start()
2791+
2792+
# FULL backup
2793+
full_id = self.backup_node(backup_dir, 'node', node)
2794+
2795+
# DELTA backup
2796+
delta_id = self.backup_node(backup_dir, 'node', node, backup_type='delta')
2797+
2798+
self.set_config(backup_dir, 'node', options=['--retention-window=1'])
2799+
2800+
backups = os.path.join(backup_dir, 'backups', 'node')
2801+
with open(
2802+
os.path.join(
2803+
backups, full_id, "backup.control"), "a") as conf:
2804+
conf.write("recovery_time='{:%Y-%m-%d %H:%M:%S}'\n".format(
2805+
datetime.now() - timedelta(days=5)))
2806+
2807+
gdb = self.backup_node(
2808+
backup_dir, "node", node,
2809+
options=['--log-level-file=VERBOSE', '--merge-expired'], gdb=True)
2810+
gdb.set_breakpoint('merge_files')
2811+
gdb.run_until_break()
2812+
2813+
logfile = os.path.join(backup_dir, 'log', 'pg_probackup.log')
2814+
2815+
with open(logfile, "rw+") as f:
2816+
f.truncate()
2817+
2818+
gdb.continue_execution_until_exit()
2819+
2820+
logfile = os.path.join(backup_dir, 'log', 'pg_probackup.log')
2821+
with open(logfile, 'r') as f:
2822+
logfile_content = f.read()
2823+
2824+
self.assertNotIn(
2825+
'SSH', logfile_content)
2826+
2827+
self.assertEqual(
2828+
'OK', self.show_pb(backup_dir, 'node')[0]['status'])
2829+
2830+
self.del_test_dir(module_name, fname)
2831+
27752832
# 1. Need new test with corrupted FULL backup
27762833
# 2. different compression levels

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy