Fix the "--progress" flag on the "compact" action to actually update the progress of segment compaction (#1333).

This commit is contained in:
Dan Helfman
2026-07-13 15:58:35 -07:00
parent 42743273d8
commit eae3341b01
3 changed files with 12 additions and 3 deletions
+8 -2
View File
@@ -10,6 +10,7 @@ from ..test_verbosity import insert_logging_mock
def insert_execute_command_mock(
compact_command,
output_log_level,
output_file=None,
working_directory=None,
borg_exit_codes=None,
):
@@ -20,6 +21,7 @@ def insert_execute_command_mock(
flexmock(module).should_receive('execute_command').with_args(
compact_command,
output_log_level=output_log_level,
output_file=output_file,
environment=None,
working_directory=working_directory,
borg_local_path=compact_command[0],
@@ -184,7 +186,9 @@ def test_compact_segments_with_remote_path_calls_borg_with_remote_path_flags():
def test_compact_segments_with_progress_calls_borg_with_progress_flag():
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
insert_execute_command_mock((*COMPACT_COMMAND, '--progress', 'repo'), logging.INFO)
insert_execute_command_mock(
(*COMPACT_COMMAND, '--progress', 'repo'), logging.INFO, module.DO_NOT_CAPTURE
)
insert_logging_mock(logging.WARNING)
module.compact_segments(
@@ -199,7 +203,9 @@ def test_compact_segments_with_progress_calls_borg_with_progress_flag():
def test_compact_segments_with_log_json_and_progress_calls_borg_with_both_flags():
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
insert_execute_command_mock(
(*COMPACT_COMMAND, '--log-json', '--progress', 'repo'), logging.INFO
(*COMPACT_COMMAND, '--log-json', '--progress', 'repo'),
logging.INFO,
module.DO_NOT_CAPTURE,
)
insert_logging_mock(logging.WARNING)