mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-08-01 14:13:01 +02:00
pass dry run flag
This commit is contained in:
@@ -41,13 +41,8 @@ def compact_segments(
|
||||
+ flags.make_repository_flags(repository_path, local_borg_version)
|
||||
)
|
||||
|
||||
if dry_run:
|
||||
if feature.available(feature.Feature.DRY_RUN_COMPACT, local_borg_version):
|
||||
logging.info('Skipping compact (dry run)')
|
||||
else:
|
||||
logging.warning(
|
||||
'The --dry-run option is not supported for compact in the current version of Borg.'
|
||||
)
|
||||
if dry_run and not feature.available(feature.Feature.DRY_RUN_COMPACT, local_borg_version):
|
||||
logging.info('Skipping compact (dry run)')
|
||||
return
|
||||
|
||||
execute_command(
|
||||
|
||||
@@ -71,9 +71,7 @@ def test_compact_segments_with_log_debug_calls_borg_with_debug_flag():
|
||||
def test_compact_segments_with_dry_run_skips_borg_call():
|
||||
# Test borg version supports dry run.
|
||||
logger_mock = flexmock(logging)
|
||||
logger_mock.should_receive('info').with_args('Skipping compact (dry run)').once()
|
||||
|
||||
flexmock(module).should_receive('execute_command').never()
|
||||
flexmock(module).should_receive('execute_command').once()
|
||||
|
||||
module.compact_segments(
|
||||
repository_path='repo',
|
||||
@@ -84,9 +82,7 @@ def test_compact_segments_with_dry_run_skips_borg_call():
|
||||
)
|
||||
|
||||
# Test borg version that does not support dry run.
|
||||
logger_mock.should_receive('warning').with_args(
|
||||
'The --dry-run option is not supported for compact in the current version of Borg.'
|
||||
).once()
|
||||
logger_mock.should_receive('info').with_args('Skipping compact (dry run)').once()
|
||||
|
||||
module.compact_segments(
|
||||
repository_path='repo',
|
||||
|
||||
Reference in New Issue
Block a user