pass dry run flag

This commit is contained in:
Vandal
2025-04-25 11:40:25 +05:30
parent 27a2bbc231
commit 1ac51e34bc
2 changed files with 4 additions and 13 deletions
+2 -7
View File
@@ -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(
+2 -6
View File
@@ -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',