mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-22 02:03:01 +02:00
When running multiple configuration files, attempt all of them even if one errors (#116).
This commit is contained in:
@@ -3,12 +3,12 @@ import sys
|
||||
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.commands import borgmatic
|
||||
from borgmatic.commands import borgmatic as module
|
||||
|
||||
|
||||
def test_run_commands_handles_multiple_json_outputs_in_array():
|
||||
(
|
||||
flexmock(borgmatic)
|
||||
flexmock(module)
|
||||
.should_receive('_run_commands_on_repository')
|
||||
.times(3)
|
||||
.replace_with(
|
||||
@@ -36,7 +36,7 @@ def test_run_commands_handles_multiple_json_outputs_in_array():
|
||||
)
|
||||
)
|
||||
|
||||
borgmatic._run_commands(
|
||||
module._run_commands(
|
||||
args=flexmock(json=True),
|
||||
consistency=None,
|
||||
local_path=None,
|
||||
@@ -45,3 +45,29 @@ def test_run_commands_handles_multiple_json_outputs_in_array():
|
||||
retention=None,
|
||||
storage=None,
|
||||
)
|
||||
|
||||
|
||||
def test_collect_configuration_run_summary_logs_info_for_success():
|
||||
flexmock(module).should_receive('run_configuration')
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=()))
|
||||
|
||||
assert any(log for log in logs if log.levelno == module.logging.INFO)
|
||||
|
||||
|
||||
def test_collect_configuration_run_summary_logs_critical_for_error():
|
||||
flexmock(module).should_receive('run_configuration').and_raise(ValueError)
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=()))
|
||||
|
||||
assert any(log for log in logs if log.levelno == module.logging.CRITICAL)
|
||||
|
||||
|
||||
def test_collect_configuration_run_summary_logs_critical_for_missing_configs():
|
||||
logs = tuple(
|
||||
module.collect_configuration_run_summary_logs(
|
||||
config_filenames=(), args=flexmock(config_paths=())
|
||||
)
|
||||
)
|
||||
|
||||
assert any(log for log in logs if log.levelno == module.logging.CRITICAL)
|
||||
|
||||
Reference in New Issue
Block a user