Revert "Fix for incorrect use of "--log-json" when looking up latest archive (#1204)."

This reverts commit 2c530cc1b9.
This commit is contained in:
Dan Helfman
2026-01-11 09:51:50 -08:00
parent 2c530cc1b9
commit 7bb27e5366
3 changed files with 17 additions and 14 deletions
+14 -12
View File
@@ -119,7 +119,7 @@ def test_get_latest_archive_calls_borg_with_flags():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
borg_local_path='borg',
borg_exit_codes=None,
environment=None,
@@ -148,7 +148,7 @@ def test_get_latest_archive_with_log_info_calls_borg_without_info_flag():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -178,7 +178,7 @@ def test_get_latest_archive_with_log_debug_calls_borg_without_debug_flag():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -208,7 +208,7 @@ def test_get_latest_archive_with_local_path_calls_borg_via_local_path():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg1', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg1', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg1',
@@ -239,7 +239,7 @@ def test_get_latest_archive_with_exit_codes_calls_borg_using_them():
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
borg_exit_codes = flexmock()
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -271,7 +271,7 @@ def test_get_latest_archive_with_remote_path_calls_borg_with_remote_path_flags()
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', '--remote-path', 'borg1', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--remote-path', 'borg1', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -304,7 +304,7 @@ def test_get_latest_archive_with_umask_calls_borg_with_umask_flags():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', '--umask', '077', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--umask', '077', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -332,7 +332,7 @@ def test_get_latest_archive_without_archives_raises():
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -362,7 +362,7 @@ def test_get_latest_archive_with_lock_wait_calls_borg_with_lock_wait_flags():
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', '--lock-wait', 'okay', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', '--lock-wait', 'okay', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -394,6 +394,7 @@ def test_get_latest_archive_calls_borg_with_list_extra_borg_options():
(
'borg',
'list',
'--log-json',
*BORG_LIST_LATEST_ARGUMENTS[:-1],
'--extra',
'value with space',
@@ -430,6 +431,7 @@ def test_get_latest_archive_with_feature_available_calls_borg_with_repo_list_ext
(
'borg',
'repo-list',
'--log-json',
*BORG_LIST_LATEST_ARGUMENTS[:-1],
'--extra',
'value with space',
@@ -466,7 +468,7 @@ def test_get_latest_archive_with_consider_checkpoints_calls_borg_with_consider_c
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', '--consider-checkpoints', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', '--consider-checkpoints', *BORG_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -499,7 +501,7 @@ def test_get_latest_archive_with_consider_checkpoints_and_feature_available_call
flexmock(module.environment).should_receive('make_environment')
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'repo-list', *BORG_REPO_LIST_LATEST_ARGUMENTS),
('borg', 'repo-list', '--log-json', *BORG_REPO_LIST_LATEST_ARGUMENTS),
environment=None,
working_directory=None,
borg_local_path='borg',
@@ -531,7 +533,7 @@ def test_get_latest_archive_calls_borg_with_working_directory():
'/working/dir',
)
flexmock(module).should_receive('execute_command_and_capture_output').with_args(
('borg', 'list', *BORG_LIST_LATEST_ARGUMENTS),
('borg', 'list', '--log-json', *BORG_LIST_LATEST_ARGUMENTS),
borg_local_path='borg',
borg_exit_codes=None,
environment=None,