Only guard repository when --extract is used.
This commit is contained in:
parent
36305c50b1
commit
c35f90154f
2 changed files with 16 additions and 7 deletions
|
@ -403,7 +403,8 @@ def collect_configuration_run_summary_logs(config_filenames, args):
|
|||
)
|
||||
yield logging.makeLogRecord(dict(levelno=logging.CRITICAL, msg=error))
|
||||
|
||||
validate.guard_configuration_contains_repository(args.repository, configs)
|
||||
if args.extract:
|
||||
validate.guard_configuration_contains_repository(args.repository, configs)
|
||||
|
||||
for config_filename, config in configs.items():
|
||||
try:
|
||||
|
|
|
@ -48,10 +48,20 @@ def test_run_commands_handles_multiple_json_outputs_in_array():
|
|||
|
||||
|
||||
def test_collect_configuration_run_summary_logs_info_for_success():
|
||||
flexmock(module.validate).should_receive('parse_configuration').and_return({'test.yaml': {}})
|
||||
flexmock(module).should_receive('run_configuration')
|
||||
args = flexmock(extract=False)
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=args))
|
||||
|
||||
assert any(log for log in logs if log.levelno == module.logging.INFO)
|
||||
|
||||
|
||||
def test_collect_configuration_run_summary_still_succeeds_when_extract_true():
|
||||
flexmock(module.validate).should_receive('parse_configuration').and_return({'test.yaml': {}})
|
||||
flexmock(module.validate).should_receive('guard_configuration_contains_repository')
|
||||
flexmock(module).should_receive('run_configuration')
|
||||
args = flexmock(repository=None)
|
||||
args = flexmock(extract=True, repository='repo')
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=args))
|
||||
|
||||
|
@ -60,8 +70,7 @@ def test_collect_configuration_run_summary_logs_info_for_success():
|
|||
|
||||
def test_collect_configuration_run_summary_logs_critical_for_parse_error():
|
||||
flexmock(module.validate).should_receive('parse_configuration').and_raise(ValueError)
|
||||
flexmock(module.validate).should_receive('guard_configuration_contains_repository')
|
||||
args = flexmock(repository=None)
|
||||
args = flexmock(extract=False)
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=args))
|
||||
|
||||
|
@ -72,7 +81,7 @@ def test_collect_configuration_run_summary_logs_critical_for_run_error():
|
|||
flexmock(module.validate).should_receive('parse_configuration').and_return({'test.yaml': {}})
|
||||
flexmock(module.validate).should_receive('guard_configuration_contains_repository')
|
||||
flexmock(module).should_receive('run_configuration').and_raise(ValueError)
|
||||
args = flexmock(repository=None)
|
||||
args = flexmock(extract=False)
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(('test.yaml',), args=args))
|
||||
|
||||
|
@ -81,9 +90,8 @@ def test_collect_configuration_run_summary_logs_critical_for_run_error():
|
|||
|
||||
def test_collect_configuration_run_summary_logs_critical_for_missing_configs():
|
||||
flexmock(module.validate).should_receive('parse_configuration').and_return({'test.yaml': {}})
|
||||
flexmock(module.validate).should_receive('guard_configuration_contains_repository')
|
||||
flexmock(module).should_receive('run_configuration')
|
||||
args = flexmock(config_paths=(), repository=None)
|
||||
args = flexmock(config_paths=(), extract=False)
|
||||
|
||||
logs = tuple(module.collect_configuration_run_summary_logs(config_filenames=(), args=args))
|
||||
|
||||
|
|
Loading…
Reference in a new issue