本文整理汇总了Python中barman.recovery_executor.RecoveryExecutor._prepare_tablespaces方法的典型用法代码示例。如果您正苦于以下问题:Python RecoveryExecutor._prepare_tablespaces方法的具体用法?Python RecoveryExecutor._prepare_tablespaces怎么用?Python RecoveryExecutor._prepare_tablespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类barman.recovery_executor.RecoveryExecutor
的用法示例。
在下文中一共展示了RecoveryExecutor._prepare_tablespaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_prepare_tablespaces
# 需要导入模块: from barman.recovery_executor import RecoveryExecutor [as 别名]
# 或者: from barman.recovery_executor.RecoveryExecutor import _prepare_tablespaces [as 别名]
def test_prepare_tablespaces(self, tmpdir):
"""
Test tablespaces preparation for recovery
"""
# Prepare basic directory/files structure
dest = tmpdir.mkdir("destination")
wals = tmpdir.mkdir("wals")
backup_info = testing_helpers.build_test_backup_info(tablespaces=[("tbs1", 16387, "/fake/location")])
# build an executor
server = testing_helpers.build_real_server(main_conf={"wals_directory": wals.strpath})
executor = RecoveryExecutor(server.backup_manager)
# use a mock as cmd obj
cmd_mock = mock.Mock()
executor._prepare_tablespaces(backup_info, cmd_mock, dest.strpath, {})
cmd_mock.create_dir_if_not_exists.assert_any_call(dest.join("pg_tblspc").strpath)
cmd_mock.create_dir_if_not_exists.assert_any_call("/fake/location")
cmd_mock.delete_if_exists.assert_called_once_with(dest.join("pg_tblspc").join("16387").strpath)
cmd_mock.create_symbolic_link.assert_called_once_with(
"/fake/location", dest.join("pg_tblspc").join("16387").strpath
)