mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-08-02 14:43:02 +02:00
Fix error when running the "prune" action with both "archive_name_format" and "prefix" options set (#668).
This commit is contained in:
@@ -69,6 +69,24 @@ def test_make_prune_flags_with_prefix_without_borg_features_uses_glob_archives()
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_make_prune_flags_prefers_prefix_to_archive_name_format():
|
||||
storage_config = {'archive_name_format': 'bar-{now}'} # noqa: FS003
|
||||
retention_config = OrderedDict((('keep_daily', 1), ('prefix', 'bar-')))
|
||||
flexmock(module.feature).should_receive('available').and_return(True)
|
||||
flexmock(module.flags).should_receive('make_match_archives_flags').never()
|
||||
|
||||
result = module.make_prune_flags(storage_config, retention_config, local_borg_version='1.2.3')
|
||||
|
||||
expected = (
|
||||
'--keep-daily',
|
||||
'1',
|
||||
'--match-archives',
|
||||
'sh:bar-*', # noqa: FS003
|
||||
)
|
||||
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_make_prune_flags_without_prefix_uses_archive_name_format_instead():
|
||||
storage_config = {'archive_name_format': 'bar-{now}'} # noqa: FS003
|
||||
retention_config = OrderedDict((('keep_daily', 1), ('prefix', None)))
|
||||
|
||||
Reference in New Issue
Block a user