本文整理汇总了Python中barman.infofile.WalFileInfo.compression方法的典型用法代码示例。如果您正苦于以下问题:Python WalFileInfo.compression方法的具体用法?Python WalFileInfo.compression怎么用?Python WalFileInfo.compression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类barman.infofile.WalFileInfo
的用法示例。
在下文中一共展示了WalFileInfo.compression方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_wal_until_next_backup
# 需要导入模块: from barman.infofile import WalFileInfo [as 别名]
# 或者: from barman.infofile.WalFileInfo import compression [as 别名]
def test_get_wal_until_next_backup(self, get_backup_mock, tmpdir):
"""
Simple test for the management of .history files
"""
# build a WalFileInfo object
wfile_info = WalFileInfo()
wfile_info.name = '000000010000000000000003'
wfile_info.size = 42
wfile_info.time = 43
wfile_info.compression = None
# build a WalFileInfo history object
history_info = WalFileInfo()
history_info.name = '00000001.history'
history_info.size = 42
history_info.time = 43
history_info.compression = None
# create a xlog.db and add the 2 entries
wals_dir = tmpdir.mkdir("wals")
xlog = wals_dir.join("xlog.db")
xlog.write(wfile_info.to_xlogdb_line() + history_info.to_xlogdb_line())
# fake backup
backup = build_test_backup_info(
begin_wal='000000010000000000000001',
end_wal='000000010000000000000004')
# mock a server object and mock a return call to get_next_backup method
server = build_real_server(
global_conf={
"barman_lock_directory": tmpdir.mkdir('lock').strpath
},
main_conf={
"wals_directory": wals_dir.strpath
})
get_backup_mock.return_value = build_test_backup_info(
backup_id="1234567899",
begin_wal='000000010000000000000005',
end_wal='000000010000000000000009')
wals = []
for wal_file in server.get_wal_until_next_backup(backup,
include_history=True):
# get the result of the xlogdb read
wals.append(wal_file.name)
# check for the presence of the .history file
assert history_info.name in wals
示例2: test_to_xlogdb_line
# 需要导入模块: from barman.infofile import WalFileInfo [as 别名]
# 或者: from barman.infofile.WalFileInfo import compression [as 别名]
def test_to_xlogdb_line(self):
wfile_info = WalFileInfo()
wfile_info.name = '000000000000000000000002'
wfile_info.size = 42
wfile_info.time = 43
wfile_info.compression = None
assert wfile_info.relpath() == '0000000000000000/000000000000000000000002'
assert wfile_info.to_xlogdb_line() == '000000000000000000000002\t42\t43\tNone\n'
示例3: test_from_xlogdb_line
# 需要导入模块: from barman.infofile import WalFileInfo [as 别名]
# 或者: from barman.infofile.WalFileInfo import compression [as 别名]
def test_from_xlogdb_line(self):
"""
Test the conversion from a string to a WalFileInfo file
"""
# build a WalFileInfo object
wfile_info = WalFileInfo()
wfile_info.name = "000000000000000000000001"
wfile_info.size = 42
wfile_info.time = 43
wfile_info.compression = None
assert wfile_info.relpath() == ("0000000000000000/000000000000000000000001")
# mock a server object
server = mock.Mock(name="server")
server.config.wals_directory = "/tmp/wals"
# parse the string
info_file = wfile_info.from_xlogdb_line("000000000000000000000001\t42\t43\tNone\n")
assert list(wfile_info.items()) == list(info_file.items())