当前位置: 首页>>代码示例>>Python>>正文


Python RecoveryExecutor._generate_recovery_conf方法代码示例

本文整理汇总了Python中barman.recovery_executor.RecoveryExecutor._generate_recovery_conf方法的典型用法代码示例。如果您正苦于以下问题:Python RecoveryExecutor._generate_recovery_conf方法的具体用法?Python RecoveryExecutor._generate_recovery_conf怎么用?Python RecoveryExecutor._generate_recovery_conf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在barman.recovery_executor.RecoveryExecutor的用法示例。


在下文中一共展示了RecoveryExecutor._generate_recovery_conf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_generate_recovery_conf

# 需要导入模块: from barman.recovery_executor import RecoveryExecutor [as 别名]
# 或者: from barman.recovery_executor.RecoveryExecutor import _generate_recovery_conf [as 别名]
 def test_generate_recovery_conf(self, rsync_pg_mock, tmpdir):
     """
     Test the generation of recovery.conf file
     """
     # Build basic folder/files structure
     recovery_info = {
         "configuration_files": ["postgresql.conf", "postgresql.auto.conf"],
         "tempdir": tmpdir.strpath,
         "results": {"changes": [], "warnings": []},
         "get_wal": False,
     }
     backup_info = testing_helpers.build_test_backup_info()
     dest = tmpdir.mkdir("destination")
     # Build a recovery executor using a real server
     server = testing_helpers.build_real_server()
     executor = RecoveryExecutor(server.backup_manager)
     executor._generate_recovery_conf(
         recovery_info,
         backup_info,
         dest.strpath,
         True,
         "[email protected]",
         "target_name",
         "2015-06-03 16:11:03.71038+02",
         "2",
         "",
     )
     # Check that the recovery.conf file exists
     recovery_conf_file = tmpdir.join("recovery.conf")
     assert recovery_conf_file.check()
     # Parse the generated recovery.conf
     recovery_conf = {}
     for line in recovery_conf_file.readlines():
         key, value = (s.strip() for s in line.strip().split("=", 1))
         recovery_conf[key] = value
     # check for contents
     assert "recovery_end_command" in recovery_conf
     assert "recovery_target_time" in recovery_conf
     assert "recovery_target_timeline" in recovery_conf
     assert "recovery_target_xid" not in recovery_conf
     assert "recovery_target_name" in recovery_conf
     assert recovery_conf["recovery_end_command"] == "'rm -fr barman_xlog'"
     assert recovery_conf["recovery_target_time"] == "'2015-06-03 16:11:03.71038+02'"
     assert recovery_conf["recovery_target_timeline"] == "2"
     assert recovery_conf["recovery_target_name"] == "'target_name'"
开发者ID:moench-tegeder,项目名称:barman,代码行数:47,代码来源:test_recovery_executor.py


注:本文中的barman.recovery_executor.RecoveryExecutor._generate_recovery_conf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。