test_borgmatic.py 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. import logging
  2. import subprocess
  3. import time
  4. from flexmock import flexmock
  5. import borgmatic.hooks.command
  6. from borgmatic.commands import borgmatic as module
  7. def test_run_configuration_runs_actions_for_each_repository():
  8. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  9. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  10. expected_results = [flexmock(), flexmock()]
  11. flexmock(module).should_receive('run_actions').and_return(expected_results[:1]).and_return(
  12. expected_results[1:]
  13. )
  14. config = {'location': {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}}
  15. arguments = {'global': flexmock(monitoring_verbosity=1)}
  16. results = list(module.run_configuration('test.yaml', config, arguments))
  17. assert results == expected_results
  18. def test_run_configuration_with_invalid_borg_version_errors():
  19. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  20. flexmock(module.borg_version).should_receive('local_borg_version').and_raise(ValueError)
  21. flexmock(module.command).should_receive('execute_hook').never()
  22. flexmock(module.dispatch).should_receive('call_hooks').never()
  23. flexmock(module).should_receive('run_actions').never()
  24. config = {'location': {'repositories': ['foo']}}
  25. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'prune': flexmock()}
  26. list(module.run_configuration('test.yaml', config, arguments))
  27. def test_run_configuration_logs_monitor_start_error():
  28. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  29. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  30. flexmock(module.dispatch).should_receive('call_hooks').and_raise(OSError).and_return(
  31. None
  32. ).and_return(None).and_return(None)
  33. expected_results = [flexmock()]
  34. flexmock(module).should_receive('log_error_records').and_return(expected_results)
  35. flexmock(module).should_receive('run_actions').never()
  36. config = {'location': {'repositories': ['foo']}}
  37. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  38. results = list(module.run_configuration('test.yaml', config, arguments))
  39. assert results == expected_results
  40. def test_run_configuration_bails_for_monitor_start_soft_failure():
  41. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  42. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  43. error = subprocess.CalledProcessError(borgmatic.hooks.command.SOFT_FAIL_EXIT_CODE, 'try again')
  44. flexmock(module.dispatch).should_receive('call_hooks').and_raise(error)
  45. flexmock(module).should_receive('log_error_records').never()
  46. flexmock(module).should_receive('run_actions').never()
  47. config = {'location': {'repositories': ['foo']}}
  48. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  49. results = list(module.run_configuration('test.yaml', config, arguments))
  50. assert results == []
  51. def test_run_configuration_logs_actions_error():
  52. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  53. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  54. flexmock(module.command).should_receive('execute_hook')
  55. flexmock(module.dispatch).should_receive('call_hooks')
  56. expected_results = [flexmock()]
  57. flexmock(module).should_receive('log_error_records').and_return(expected_results)
  58. flexmock(module).should_receive('run_actions').and_raise(OSError)
  59. config = {'location': {'repositories': [{'path': 'foo'}]}}
  60. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False)}
  61. results = list(module.run_configuration('test.yaml', config, arguments))
  62. assert results == expected_results
  63. def test_run_configuration_bails_for_actions_soft_failure():
  64. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  65. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  66. flexmock(module.dispatch).should_receive('call_hooks')
  67. error = subprocess.CalledProcessError(borgmatic.hooks.command.SOFT_FAIL_EXIT_CODE, 'try again')
  68. flexmock(module).should_receive('run_actions').and_raise(error)
  69. flexmock(module).should_receive('log_error_records').never()
  70. flexmock(module.command).should_receive('considered_soft_failure').and_return(True)
  71. config = {'location': {'repositories': [{'path': 'foo'}]}}
  72. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  73. results = list(module.run_configuration('test.yaml', config, arguments))
  74. assert results == []
  75. def test_run_configuration_logs_monitor_log_error():
  76. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  77. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  78. flexmock(module.dispatch).should_receive('call_hooks').and_return(None).and_return(
  79. None
  80. ).and_raise(OSError)
  81. expected_results = [flexmock()]
  82. flexmock(module).should_receive('log_error_records').and_return(expected_results)
  83. flexmock(module).should_receive('run_actions').and_return([])
  84. config = {'location': {'repositories': [{'path': 'foo'}]}}
  85. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  86. results = list(module.run_configuration('test.yaml', config, arguments))
  87. assert results == expected_results
  88. def test_run_configuration_bails_for_monitor_log_soft_failure():
  89. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  90. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  91. error = subprocess.CalledProcessError(borgmatic.hooks.command.SOFT_FAIL_EXIT_CODE, 'try again')
  92. flexmock(module.dispatch).should_receive('call_hooks').and_return(None).and_return(
  93. None
  94. ).and_raise(error)
  95. flexmock(module).should_receive('log_error_records').never()
  96. flexmock(module).should_receive('run_actions').and_return([])
  97. flexmock(module.command).should_receive('considered_soft_failure').and_return(True)
  98. config = {'location': {'repositories': [{'path': 'foo'}]}}
  99. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  100. results = list(module.run_configuration('test.yaml', config, arguments))
  101. assert results == []
  102. def test_run_configuration_logs_monitor_finish_error():
  103. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  104. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  105. flexmock(module.dispatch).should_receive('call_hooks').and_return(None).and_return(
  106. None
  107. ).and_return(None).and_raise(OSError)
  108. expected_results = [flexmock()]
  109. flexmock(module).should_receive('log_error_records').and_return(expected_results)
  110. flexmock(module).should_receive('run_actions').and_return([])
  111. config = {'location': {'repositories': [{'path': 'foo'}]}}
  112. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  113. results = list(module.run_configuration('test.yaml', config, arguments))
  114. assert results == expected_results
  115. def test_run_configuration_bails_for_monitor_finish_soft_failure():
  116. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  117. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  118. error = subprocess.CalledProcessError(borgmatic.hooks.command.SOFT_FAIL_EXIT_CODE, 'try again')
  119. flexmock(module.dispatch).should_receive('call_hooks').and_return(None).and_return(
  120. None
  121. ).and_raise(None).and_raise(error)
  122. flexmock(module).should_receive('log_error_records').never()
  123. flexmock(module).should_receive('run_actions').and_return([])
  124. flexmock(module.command).should_receive('considered_soft_failure').and_return(True)
  125. config = {'location': {'repositories': [{'path': 'foo'}]}}
  126. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  127. results = list(module.run_configuration('test.yaml', config, arguments))
  128. assert results == []
  129. def test_run_configuration_logs_on_error_hook_error():
  130. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  131. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  132. flexmock(module.command).should_receive('execute_hook').and_raise(OSError)
  133. expected_results = [flexmock(), flexmock()]
  134. flexmock(module).should_receive('log_error_records').and_return(
  135. expected_results[:1]
  136. ).and_return(expected_results[1:])
  137. flexmock(module).should_receive('run_actions').and_raise(OSError)
  138. config = {'location': {'repositories': [{'path': 'foo'}]}}
  139. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  140. results = list(module.run_configuration('test.yaml', config, arguments))
  141. assert results == expected_results
  142. def test_run_configuration_bails_for_on_error_hook_soft_failure():
  143. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  144. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  145. error = subprocess.CalledProcessError(borgmatic.hooks.command.SOFT_FAIL_EXIT_CODE, 'try again')
  146. flexmock(module.command).should_receive('execute_hook').and_raise(error)
  147. expected_results = [flexmock()]
  148. flexmock(module).should_receive('log_error_records').and_return(expected_results)
  149. flexmock(module).should_receive('run_actions').and_raise(OSError)
  150. config = {'location': {'repositories': [{'path': 'foo'}]}}
  151. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  152. results = list(module.run_configuration('test.yaml', config, arguments))
  153. assert results == expected_results
  154. def test_run_configuration_retries_soft_error():
  155. # Run action first fails, second passes
  156. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  157. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  158. flexmock(module.command).should_receive('execute_hook')
  159. flexmock(module).should_receive('run_actions').and_raise(OSError).and_return([])
  160. flexmock(module).should_receive('log_error_records').and_return([flexmock()]).once()
  161. config = {'location': {'repositories': [{'path': 'foo'}]}, 'storage': {'retries': 1}}
  162. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  163. results = list(module.run_configuration('test.yaml', config, arguments))
  164. assert results == []
  165. def test_run_configuration_retries_hard_error():
  166. # Run action fails twice
  167. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  168. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  169. flexmock(module.command).should_receive('execute_hook')
  170. flexmock(module).should_receive('run_actions').and_raise(OSError).times(2)
  171. flexmock(module).should_receive('log_error_records').with_args(
  172. 'foo: Error running actions for repository',
  173. OSError,
  174. levelno=logging.WARNING,
  175. log_command_error_output=True,
  176. ).and_return([flexmock()])
  177. error_logs = [flexmock()]
  178. flexmock(module).should_receive('log_error_records').with_args(
  179. 'foo: Error running actions for repository', OSError,
  180. ).and_return(error_logs)
  181. config = {'location': {'repositories': [{'path': 'foo'}]}, 'storage': {'retries': 1}}
  182. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  183. results = list(module.run_configuration('test.yaml', config, arguments))
  184. assert results == error_logs
  185. def test_run_configuration_repos_ordered():
  186. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  187. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  188. flexmock(module.command).should_receive('execute_hook')
  189. flexmock(module).should_receive('run_actions').and_raise(OSError).times(2)
  190. expected_results = [flexmock(), flexmock()]
  191. flexmock(module).should_receive('log_error_records').with_args(
  192. 'foo: Error running actions for repository', OSError
  193. ).and_return(expected_results[:1]).ordered()
  194. flexmock(module).should_receive('log_error_records').with_args(
  195. 'bar: Error running actions for repository', OSError
  196. ).and_return(expected_results[1:]).ordered()
  197. config = {'location': {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}}
  198. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  199. results = list(module.run_configuration('test.yaml', config, arguments))
  200. assert results == expected_results
  201. def test_run_configuration_retries_round_robin():
  202. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  203. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  204. flexmock(module.command).should_receive('execute_hook')
  205. flexmock(module).should_receive('run_actions').and_raise(OSError).times(4)
  206. flexmock(module).should_receive('log_error_records').with_args(
  207. 'foo: Error running actions for repository',
  208. OSError,
  209. levelno=logging.WARNING,
  210. log_command_error_output=True,
  211. ).and_return([flexmock()]).ordered()
  212. flexmock(module).should_receive('log_error_records').with_args(
  213. 'bar: Error running actions for repository',
  214. OSError,
  215. levelno=logging.WARNING,
  216. log_command_error_output=True,
  217. ).and_return([flexmock()]).ordered()
  218. foo_error_logs = [flexmock()]
  219. flexmock(module).should_receive('log_error_records').with_args(
  220. 'foo: Error running actions for repository', OSError
  221. ).and_return(foo_error_logs).ordered()
  222. bar_error_logs = [flexmock()]
  223. flexmock(module).should_receive('log_error_records').with_args(
  224. 'bar: Error running actions for repository', OSError
  225. ).and_return(bar_error_logs).ordered()
  226. config = {
  227. 'location': {'repositories': [{'path': 'foo'}, {'path': 'bar'}]},
  228. 'storage': {'retries': 1},
  229. }
  230. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  231. results = list(module.run_configuration('test.yaml', config, arguments))
  232. assert results == foo_error_logs + bar_error_logs
  233. def test_run_configuration_retries_one_passes():
  234. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  235. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  236. flexmock(module.command).should_receive('execute_hook')
  237. flexmock(module).should_receive('run_actions').and_raise(OSError).and_raise(OSError).and_return(
  238. []
  239. ).and_raise(OSError).times(4)
  240. flexmock(module).should_receive('log_error_records').with_args(
  241. 'foo: Error running actions for repository',
  242. OSError,
  243. levelno=logging.WARNING,
  244. log_command_error_output=True,
  245. ).and_return([flexmock()]).ordered()
  246. flexmock(module).should_receive('log_error_records').with_args(
  247. 'bar: Error running actions for repository',
  248. OSError,
  249. levelno=logging.WARNING,
  250. log_command_error_output=True,
  251. ).and_return(flexmock()).ordered()
  252. error_logs = [flexmock()]
  253. flexmock(module).should_receive('log_error_records').with_args(
  254. 'bar: Error running actions for repository', OSError
  255. ).and_return(error_logs).ordered()
  256. config = {
  257. 'location': {'repositories': [{'path': 'foo'}, {'path': 'bar'}]},
  258. 'storage': {'retries': 1},
  259. }
  260. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  261. results = list(module.run_configuration('test.yaml', config, arguments))
  262. assert results == error_logs
  263. def test_run_configuration_retry_wait():
  264. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  265. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  266. flexmock(module.command).should_receive('execute_hook')
  267. flexmock(module).should_receive('run_actions').and_raise(OSError).times(4)
  268. flexmock(module).should_receive('log_error_records').with_args(
  269. 'foo: Error running actions for repository',
  270. OSError,
  271. levelno=logging.WARNING,
  272. log_command_error_output=True,
  273. ).and_return([flexmock()]).ordered()
  274. flexmock(time).should_receive('sleep').with_args(10).and_return().ordered()
  275. flexmock(module).should_receive('log_error_records').with_args(
  276. 'foo: Error running actions for repository',
  277. OSError,
  278. levelno=logging.WARNING,
  279. log_command_error_output=True,
  280. ).and_return([flexmock()]).ordered()
  281. flexmock(time).should_receive('sleep').with_args(20).and_return().ordered()
  282. flexmock(module).should_receive('log_error_records').with_args(
  283. 'foo: Error running actions for repository',
  284. OSError,
  285. levelno=logging.WARNING,
  286. log_command_error_output=True,
  287. ).and_return([flexmock()]).ordered()
  288. flexmock(time).should_receive('sleep').with_args(30).and_return().ordered()
  289. error_logs = [flexmock()]
  290. flexmock(module).should_receive('log_error_records').with_args(
  291. 'foo: Error running actions for repository', OSError
  292. ).and_return(error_logs).ordered()
  293. config = {
  294. 'location': {'repositories': [{'path': 'foo'}]},
  295. 'storage': {'retries': 3, 'retry_wait': 10},
  296. }
  297. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  298. results = list(module.run_configuration('test.yaml', config, arguments))
  299. assert results == error_logs
  300. def test_run_configuration_retries_timeout_multiple_repos():
  301. flexmock(module).should_receive('verbosity_to_log_level').and_return(logging.INFO)
  302. flexmock(module.borg_version).should_receive('local_borg_version').and_return(flexmock())
  303. flexmock(module.command).should_receive('execute_hook')
  304. flexmock(module).should_receive('run_actions').and_raise(OSError).and_raise(OSError).and_return(
  305. []
  306. ).and_raise(OSError).times(4)
  307. flexmock(module).should_receive('log_error_records').with_args(
  308. 'foo: Error running actions for repository',
  309. OSError,
  310. levelno=logging.WARNING,
  311. log_command_error_output=True,
  312. ).and_return([flexmock()]).ordered()
  313. flexmock(module).should_receive('log_error_records').with_args(
  314. 'bar: Error running actions for repository',
  315. OSError,
  316. levelno=logging.WARNING,
  317. log_command_error_output=True,
  318. ).and_return([flexmock()]).ordered()
  319. # Sleep before retrying foo (and passing)
  320. flexmock(time).should_receive('sleep').with_args(10).and_return().ordered()
  321. # Sleep before retrying bar (and failing)
  322. flexmock(time).should_receive('sleep').with_args(10).and_return().ordered()
  323. error_logs = [flexmock()]
  324. flexmock(module).should_receive('log_error_records').with_args(
  325. 'bar: Error running actions for repository', OSError
  326. ).and_return(error_logs).ordered()
  327. config = {
  328. 'location': {'repositories': [{'path': 'foo'}, {'path': 'bar'}]},
  329. 'storage': {'retries': 1, 'retry_wait': 10},
  330. }
  331. arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False), 'create': flexmock()}
  332. results = list(module.run_configuration('test.yaml', config, arguments))
  333. assert results == error_logs
  334. def test_run_actions_runs_rcreate():
  335. flexmock(module).should_receive('add_custom_log_levels')
  336. flexmock(module.command).should_receive('execute_hook')
  337. flexmock(borgmatic.actions.rcreate).should_receive('run_rcreate').once()
  338. tuple(
  339. module.run_actions(
  340. arguments={'global': flexmock(dry_run=False), 'rcreate': flexmock()},
  341. config_filename=flexmock(),
  342. location={'repositories': []},
  343. storage=flexmock(),
  344. retention=flexmock(),
  345. consistency=flexmock(),
  346. hooks={},
  347. local_path=flexmock(),
  348. remote_path=flexmock(),
  349. local_borg_version=flexmock(),
  350. repository={'path': 'repo'},
  351. )
  352. )
  353. def test_run_actions_adds_log_file_to_hook_context():
  354. flexmock(module).should_receive('add_custom_log_levels')
  355. flexmock(module.command).should_receive('execute_hook')
  356. flexmock(borgmatic.actions.rcreate).should_receive('run_rcreate').once()
  357. tuple(
  358. module.run_actions(
  359. arguments={'global': flexmock(dry_run=False, log_file='foo'), 'rcreate': flexmock()},
  360. config_filename=flexmock(),
  361. location={'repositories': []},
  362. storage=flexmock(),
  363. retention=flexmock(),
  364. consistency=flexmock(),
  365. hooks={},
  366. local_path=flexmock(),
  367. remote_path=flexmock(),
  368. local_borg_version=flexmock(),
  369. repository={'path': 'repo'},
  370. )
  371. )
  372. def test_run_actions_runs_transfer():
  373. flexmock(module).should_receive('add_custom_log_levels')
  374. flexmock(module.command).should_receive('execute_hook')
  375. flexmock(borgmatic.actions.transfer).should_receive('run_transfer').once()
  376. tuple(
  377. module.run_actions(
  378. arguments={'global': flexmock(dry_run=False), 'transfer': flexmock()},
  379. config_filename=flexmock(),
  380. location={'repositories': []},
  381. storage=flexmock(),
  382. retention=flexmock(),
  383. consistency=flexmock(),
  384. hooks={},
  385. local_path=flexmock(),
  386. remote_path=flexmock(),
  387. local_borg_version=flexmock(),
  388. repository={'path': 'repo'},
  389. )
  390. )
  391. def test_run_actions_runs_create():
  392. flexmock(module).should_receive('add_custom_log_levels')
  393. flexmock(module.command).should_receive('execute_hook')
  394. expected = flexmock()
  395. flexmock(borgmatic.actions.create).should_receive('run_create').and_yield(expected).once()
  396. result = tuple(
  397. module.run_actions(
  398. arguments={'global': flexmock(dry_run=False), 'create': flexmock()},
  399. config_filename=flexmock(),
  400. location={'repositories': []},
  401. storage=flexmock(),
  402. retention=flexmock(),
  403. consistency=flexmock(),
  404. hooks={},
  405. local_path=flexmock(),
  406. remote_path=flexmock(),
  407. local_borg_version=flexmock(),
  408. repository={'path': 'repo'},
  409. )
  410. )
  411. assert result == (expected,)
  412. def test_run_actions_runs_prune():
  413. flexmock(module).should_receive('add_custom_log_levels')
  414. flexmock(module.command).should_receive('execute_hook')
  415. flexmock(borgmatic.actions.prune).should_receive('run_prune').once()
  416. tuple(
  417. module.run_actions(
  418. arguments={'global': flexmock(dry_run=False), 'prune': flexmock()},
  419. config_filename=flexmock(),
  420. location={'repositories': []},
  421. storage=flexmock(),
  422. retention=flexmock(),
  423. consistency=flexmock(),
  424. hooks={},
  425. local_path=flexmock(),
  426. remote_path=flexmock(),
  427. local_borg_version=flexmock(),
  428. repository={'path': 'repo'},
  429. )
  430. )
  431. def test_run_actions_runs_compact():
  432. flexmock(module).should_receive('add_custom_log_levels')
  433. flexmock(module.command).should_receive('execute_hook')
  434. flexmock(borgmatic.actions.compact).should_receive('run_compact').once()
  435. tuple(
  436. module.run_actions(
  437. arguments={'global': flexmock(dry_run=False), 'compact': flexmock()},
  438. config_filename=flexmock(),
  439. location={'repositories': []},
  440. storage=flexmock(),
  441. retention=flexmock(),
  442. consistency=flexmock(),
  443. hooks={},
  444. local_path=flexmock(),
  445. remote_path=flexmock(),
  446. local_borg_version=flexmock(),
  447. repository={'path': 'repo'},
  448. )
  449. )
  450. def test_run_actions_runs_check_when_repository_enabled_for_checks():
  451. flexmock(module).should_receive('add_custom_log_levels')
  452. flexmock(module.command).should_receive('execute_hook')
  453. flexmock(module.checks).should_receive('repository_enabled_for_checks').and_return(True)
  454. flexmock(borgmatic.actions.check).should_receive('run_check').once()
  455. tuple(
  456. module.run_actions(
  457. arguments={'global': flexmock(dry_run=False), 'check': flexmock()},
  458. config_filename=flexmock(),
  459. location={'repositories': []},
  460. storage=flexmock(),
  461. retention=flexmock(),
  462. consistency=flexmock(),
  463. hooks={},
  464. local_path=flexmock(),
  465. remote_path=flexmock(),
  466. local_borg_version=flexmock(),
  467. repository={'path': 'repo'},
  468. )
  469. )
  470. def test_run_actions_skips_check_when_repository_not_enabled_for_checks():
  471. flexmock(module).should_receive('add_custom_log_levels')
  472. flexmock(module.command).should_receive('execute_hook')
  473. flexmock(module.checks).should_receive('repository_enabled_for_checks').and_return(False)
  474. flexmock(borgmatic.actions.check).should_receive('run_check').never()
  475. tuple(
  476. module.run_actions(
  477. arguments={'global': flexmock(dry_run=False), 'check': flexmock()},
  478. config_filename=flexmock(),
  479. location={'repositories': []},
  480. storage=flexmock(),
  481. retention=flexmock(),
  482. consistency=flexmock(),
  483. hooks={},
  484. local_path=flexmock(),
  485. remote_path=flexmock(),
  486. local_borg_version=flexmock(),
  487. repository={'path': 'repo'},
  488. )
  489. )
  490. def test_run_actions_runs_extract():
  491. flexmock(module).should_receive('add_custom_log_levels')
  492. flexmock(module.command).should_receive('execute_hook')
  493. flexmock(borgmatic.actions.extract).should_receive('run_extract').once()
  494. tuple(
  495. module.run_actions(
  496. arguments={'global': flexmock(dry_run=False), 'extract': flexmock()},
  497. config_filename=flexmock(),
  498. location={'repositories': []},
  499. storage=flexmock(),
  500. retention=flexmock(),
  501. consistency=flexmock(),
  502. hooks={},
  503. local_path=flexmock(),
  504. remote_path=flexmock(),
  505. local_borg_version=flexmock(),
  506. repository={'path': 'repo'},
  507. )
  508. )
  509. def test_run_actions_runs_export_tar():
  510. flexmock(module).should_receive('add_custom_log_levels')
  511. flexmock(module.command).should_receive('execute_hook')
  512. flexmock(borgmatic.actions.export_tar).should_receive('run_export_tar').once()
  513. tuple(
  514. module.run_actions(
  515. arguments={'global': flexmock(dry_run=False), 'export-tar': flexmock()},
  516. config_filename=flexmock(),
  517. location={'repositories': []},
  518. storage=flexmock(),
  519. retention=flexmock(),
  520. consistency=flexmock(),
  521. hooks={},
  522. local_path=flexmock(),
  523. remote_path=flexmock(),
  524. local_borg_version=flexmock(),
  525. repository={'path': 'repo'},
  526. )
  527. )
  528. def test_run_actions_runs_mount():
  529. flexmock(module).should_receive('add_custom_log_levels')
  530. flexmock(module.command).should_receive('execute_hook')
  531. flexmock(borgmatic.actions.mount).should_receive('run_mount').once()
  532. tuple(
  533. module.run_actions(
  534. arguments={'global': flexmock(dry_run=False), 'mount': flexmock()},
  535. config_filename=flexmock(),
  536. location={'repositories': []},
  537. storage=flexmock(),
  538. retention=flexmock(),
  539. consistency=flexmock(),
  540. hooks={},
  541. local_path=flexmock(),
  542. remote_path=flexmock(),
  543. local_borg_version=flexmock(),
  544. repository={'path': 'repo'},
  545. )
  546. )
  547. def test_run_actions_runs_restore():
  548. flexmock(module).should_receive('add_custom_log_levels')
  549. flexmock(module.command).should_receive('execute_hook')
  550. flexmock(borgmatic.actions.restore).should_receive('run_restore').once()
  551. tuple(
  552. module.run_actions(
  553. arguments={'global': flexmock(dry_run=False), 'restore': flexmock()},
  554. config_filename=flexmock(),
  555. location={'repositories': []},
  556. storage=flexmock(),
  557. retention=flexmock(),
  558. consistency=flexmock(),
  559. hooks={},
  560. local_path=flexmock(),
  561. remote_path=flexmock(),
  562. local_borg_version=flexmock(),
  563. repository={'path': 'repo'},
  564. )
  565. )
  566. def test_run_actions_runs_rlist():
  567. flexmock(module).should_receive('add_custom_log_levels')
  568. flexmock(module.command).should_receive('execute_hook')
  569. expected = flexmock()
  570. flexmock(borgmatic.actions.rlist).should_receive('run_rlist').and_yield(expected).once()
  571. result = tuple(
  572. module.run_actions(
  573. arguments={'global': flexmock(dry_run=False), 'rlist': flexmock()},
  574. config_filename=flexmock(),
  575. location={'repositories': []},
  576. storage=flexmock(),
  577. retention=flexmock(),
  578. consistency=flexmock(),
  579. hooks={},
  580. local_path=flexmock(),
  581. remote_path=flexmock(),
  582. local_borg_version=flexmock(),
  583. repository={'path': 'repo'},
  584. )
  585. )
  586. assert result == (expected,)
  587. def test_run_actions_runs_list():
  588. flexmock(module).should_receive('add_custom_log_levels')
  589. flexmock(module.command).should_receive('execute_hook')
  590. expected = flexmock()
  591. flexmock(borgmatic.actions.list).should_receive('run_list').and_yield(expected).once()
  592. result = tuple(
  593. module.run_actions(
  594. arguments={'global': flexmock(dry_run=False), 'list': flexmock()},
  595. config_filename=flexmock(),
  596. location={'repositories': []},
  597. storage=flexmock(),
  598. retention=flexmock(),
  599. consistency=flexmock(),
  600. hooks={},
  601. local_path=flexmock(),
  602. remote_path=flexmock(),
  603. local_borg_version=flexmock(),
  604. repository={'path': 'repo'},
  605. )
  606. )
  607. assert result == (expected,)
  608. def test_run_actions_runs_rinfo():
  609. flexmock(module).should_receive('add_custom_log_levels')
  610. flexmock(module.command).should_receive('execute_hook')
  611. expected = flexmock()
  612. flexmock(borgmatic.actions.rinfo).should_receive('run_rinfo').and_yield(expected).once()
  613. result = tuple(
  614. module.run_actions(
  615. arguments={'global': flexmock(dry_run=False), 'rinfo': flexmock()},
  616. config_filename=flexmock(),
  617. location={'repositories': []},
  618. storage=flexmock(),
  619. retention=flexmock(),
  620. consistency=flexmock(),
  621. hooks={},
  622. local_path=flexmock(),
  623. remote_path=flexmock(),
  624. local_borg_version=flexmock(),
  625. repository={'path': 'repo'},
  626. )
  627. )
  628. assert result == (expected,)
  629. def test_run_actions_runs_info():
  630. flexmock(module).should_receive('add_custom_log_levels')
  631. flexmock(module.command).should_receive('execute_hook')
  632. expected = flexmock()
  633. flexmock(borgmatic.actions.info).should_receive('run_info').and_yield(expected).once()
  634. result = tuple(
  635. module.run_actions(
  636. arguments={'global': flexmock(dry_run=False), 'info': flexmock()},
  637. config_filename=flexmock(),
  638. location={'repositories': []},
  639. storage=flexmock(),
  640. retention=flexmock(),
  641. consistency=flexmock(),
  642. hooks={},
  643. local_path=flexmock(),
  644. remote_path=flexmock(),
  645. local_borg_version=flexmock(),
  646. repository={'path': 'repo'},
  647. )
  648. )
  649. assert result == (expected,)
  650. def test_run_actions_runs_break_lock():
  651. flexmock(module).should_receive('add_custom_log_levels')
  652. flexmock(module.command).should_receive('execute_hook')
  653. flexmock(borgmatic.actions.break_lock).should_receive('run_break_lock').once()
  654. tuple(
  655. module.run_actions(
  656. arguments={'global': flexmock(dry_run=False), 'break-lock': flexmock()},
  657. config_filename=flexmock(),
  658. location={'repositories': []},
  659. storage=flexmock(),
  660. retention=flexmock(),
  661. consistency=flexmock(),
  662. hooks={},
  663. local_path=flexmock(),
  664. remote_path=flexmock(),
  665. local_borg_version=flexmock(),
  666. repository={'path': 'repo'},
  667. )
  668. )
  669. def test_run_actions_runs_borg():
  670. flexmock(module).should_receive('add_custom_log_levels')
  671. flexmock(module.command).should_receive('execute_hook')
  672. flexmock(borgmatic.actions.borg).should_receive('run_borg').once()
  673. tuple(
  674. module.run_actions(
  675. arguments={'global': flexmock(dry_run=False), 'borg': flexmock()},
  676. config_filename=flexmock(),
  677. location={'repositories': []},
  678. storage=flexmock(),
  679. retention=flexmock(),
  680. consistency=flexmock(),
  681. hooks={},
  682. local_path=flexmock(),
  683. remote_path=flexmock(),
  684. local_borg_version=flexmock(),
  685. repository={'path': 'repo'},
  686. )
  687. )
  688. def test_run_actions_runs_multiple_actions_in_argument_order():
  689. flexmock(module).should_receive('add_custom_log_levels')
  690. flexmock(module.command).should_receive('execute_hook')
  691. flexmock(borgmatic.actions.borg).should_receive('run_borg').once().ordered()
  692. flexmock(borgmatic.actions.restore).should_receive('run_restore').once().ordered()
  693. tuple(
  694. module.run_actions(
  695. arguments={
  696. 'global': flexmock(dry_run=False),
  697. 'borg': flexmock(),
  698. 'restore': flexmock(),
  699. },
  700. config_filename=flexmock(),
  701. location={'repositories': []},
  702. storage=flexmock(),
  703. retention=flexmock(),
  704. consistency=flexmock(),
  705. hooks={},
  706. local_path=flexmock(),
  707. remote_path=flexmock(),
  708. local_borg_version=flexmock(),
  709. repository={'path': 'repo'},
  710. )
  711. )
  712. def test_load_configurations_collects_parsed_configurations_and_logs():
  713. configuration = flexmock()
  714. other_configuration = flexmock()
  715. test_expected_logs = [flexmock(), flexmock()]
  716. other_expected_logs = [flexmock(), flexmock()]
  717. flexmock(module.validate).should_receive('parse_configuration').and_return(
  718. configuration, test_expected_logs
  719. ).and_return(other_configuration, other_expected_logs)
  720. configs, logs = tuple(module.load_configurations(('test.yaml', 'other.yaml')))
  721. assert configs == {'test.yaml': configuration, 'other.yaml': other_configuration}
  722. assert logs == test_expected_logs + other_expected_logs
  723. def test_load_configurations_logs_warning_for_permission_error():
  724. flexmock(module.validate).should_receive('parse_configuration').and_raise(PermissionError)
  725. configs, logs = tuple(module.load_configurations(('test.yaml',)))
  726. assert configs == {}
  727. assert {log.levelno for log in logs} == {logging.WARNING}
  728. def test_load_configurations_logs_critical_for_parse_error():
  729. flexmock(module.validate).should_receive('parse_configuration').and_raise(ValueError)
  730. configs, logs = tuple(module.load_configurations(('test.yaml',)))
  731. assert configs == {}
  732. assert {log.levelno for log in logs} == {logging.CRITICAL}
  733. def test_log_record_does_not_raise():
  734. module.log_record(levelno=1, foo='bar', baz='quux')
  735. def test_log_record_with_suppress_does_not_raise():
  736. module.log_record(levelno=1, foo='bar', baz='quux', suppress_log=True)
  737. def test_log_error_records_generates_output_logs_for_message_only():
  738. flexmock(module).should_receive('log_record').replace_with(dict)
  739. logs = tuple(module.log_error_records('Error'))
  740. assert {log['levelno'] for log in logs} == {logging.CRITICAL}
  741. def test_log_error_records_generates_output_logs_for_called_process_error():
  742. flexmock(module).should_receive('log_record').replace_with(dict)
  743. flexmock(module.logger).should_receive('getEffectiveLevel').and_return(logging.WARNING)
  744. logs = tuple(
  745. module.log_error_records('Error', subprocess.CalledProcessError(1, 'ls', 'error output'))
  746. )
  747. assert {log['levelno'] for log in logs} == {logging.CRITICAL}
  748. assert any(log for log in logs if 'error output' in str(log))
  749. def test_log_error_records_generates_logs_for_value_error():
  750. flexmock(module).should_receive('log_record').replace_with(dict)
  751. logs = tuple(module.log_error_records('Error', ValueError()))
  752. assert {log['levelno'] for log in logs} == {logging.CRITICAL}
  753. def test_log_error_records_generates_logs_for_os_error():
  754. flexmock(module).should_receive('log_record').replace_with(dict)
  755. logs = tuple(module.log_error_records('Error', OSError()))
  756. assert {log['levelno'] for log in logs} == {logging.CRITICAL}
  757. def test_log_error_records_generates_nothing_for_other_error():
  758. flexmock(module).should_receive('log_record').replace_with(dict)
  759. logs = tuple(module.log_error_records('Error', KeyError()))
  760. assert logs == ()
  761. def test_get_local_path_uses_configuration_value():
  762. assert module.get_local_path({'test.yaml': {'location': {'local_path': 'borg1'}}}) == 'borg1'
  763. def test_get_local_path_without_location_defaults_to_borg():
  764. assert module.get_local_path({'test.yaml': {}}) == 'borg'
  765. def test_get_local_path_without_local_path_defaults_to_borg():
  766. assert module.get_local_path({'test.yaml': {'location': {}}}) == 'borg'
  767. def test_collect_configuration_run_summary_logs_info_for_success():
  768. flexmock(module.command).should_receive('execute_hook').never()
  769. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  770. flexmock(module).should_receive('run_configuration').and_return([])
  771. arguments = {}
  772. logs = tuple(
  773. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  774. )
  775. assert {log.levelno for log in logs} == {logging.INFO}
  776. def test_collect_configuration_run_summary_executes_hooks_for_create():
  777. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  778. flexmock(module).should_receive('run_configuration').and_return([])
  779. arguments = {'create': flexmock(), 'global': flexmock(monitoring_verbosity=1, dry_run=False)}
  780. logs = tuple(
  781. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  782. )
  783. assert {log.levelno for log in logs} == {logging.INFO}
  784. def test_collect_configuration_run_summary_logs_info_for_success_with_extract():
  785. flexmock(module.validate).should_receive('guard_single_repository_selected')
  786. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  787. flexmock(module).should_receive('run_configuration').and_return([])
  788. arguments = {'extract': flexmock(repository='repo')}
  789. logs = tuple(
  790. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  791. )
  792. assert {log.levelno for log in logs} == {logging.INFO}
  793. def test_collect_configuration_run_summary_logs_extract_with_repository_error():
  794. flexmock(module.validate).should_receive('guard_configuration_contains_repository').and_raise(
  795. ValueError
  796. )
  797. expected_logs = (flexmock(),)
  798. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  799. arguments = {'extract': flexmock(repository='repo')}
  800. logs = tuple(
  801. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  802. )
  803. assert logs == expected_logs
  804. def test_collect_configuration_run_summary_logs_info_for_success_with_mount():
  805. flexmock(module.validate).should_receive('guard_single_repository_selected')
  806. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  807. flexmock(module).should_receive('run_configuration').and_return([])
  808. arguments = {'mount': flexmock(repository='repo')}
  809. logs = tuple(
  810. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  811. )
  812. assert {log.levelno for log in logs} == {logging.INFO}
  813. def test_collect_configuration_run_summary_logs_mount_with_repository_error():
  814. flexmock(module.validate).should_receive('guard_configuration_contains_repository').and_raise(
  815. ValueError
  816. )
  817. expected_logs = (flexmock(),)
  818. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  819. arguments = {'mount': flexmock(repository='repo')}
  820. logs = tuple(
  821. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  822. )
  823. assert logs == expected_logs
  824. def test_collect_configuration_run_summary_logs_missing_configs_error():
  825. arguments = {'global': flexmock(config_paths=[])}
  826. expected_logs = (flexmock(),)
  827. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  828. logs = tuple(module.collect_configuration_run_summary_logs({}, arguments=arguments))
  829. assert logs == expected_logs
  830. def test_collect_configuration_run_summary_logs_pre_hook_error():
  831. flexmock(module.command).should_receive('execute_hook').and_raise(ValueError)
  832. expected_logs = (flexmock(),)
  833. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  834. arguments = {'create': flexmock(), 'global': flexmock(monitoring_verbosity=1, dry_run=False)}
  835. logs = tuple(
  836. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  837. )
  838. assert logs == expected_logs
  839. def test_collect_configuration_run_summary_logs_post_hook_error():
  840. flexmock(module.command).should_receive('execute_hook').and_return(None).and_raise(ValueError)
  841. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  842. flexmock(module).should_receive('run_configuration').and_return([])
  843. expected_logs = (flexmock(),)
  844. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  845. arguments = {'create': flexmock(), 'global': flexmock(monitoring_verbosity=1, dry_run=False)}
  846. logs = tuple(
  847. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  848. )
  849. assert expected_logs[0] in logs
  850. def test_collect_configuration_run_summary_logs_for_list_with_archive_and_repository_error():
  851. flexmock(module.validate).should_receive('guard_configuration_contains_repository').and_raise(
  852. ValueError
  853. )
  854. expected_logs = (flexmock(),)
  855. flexmock(module).should_receive('log_error_records').and_return(expected_logs)
  856. arguments = {'list': flexmock(repository='repo', archive='test')}
  857. logs = tuple(
  858. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  859. )
  860. assert logs == expected_logs
  861. def test_collect_configuration_run_summary_logs_info_for_success_with_list():
  862. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  863. flexmock(module).should_receive('run_configuration').and_return([])
  864. arguments = {'list': flexmock(repository='repo', archive=None)}
  865. logs = tuple(
  866. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  867. )
  868. assert {log.levelno for log in logs} == {logging.INFO}
  869. def test_collect_configuration_run_summary_logs_run_configuration_error():
  870. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  871. flexmock(module).should_receive('run_configuration').and_return(
  872. [logging.makeLogRecord(dict(levelno=logging.CRITICAL, levelname='CRITICAL', msg='Error'))]
  873. )
  874. flexmock(module).should_receive('log_error_records').and_return([])
  875. arguments = {}
  876. logs = tuple(
  877. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  878. )
  879. assert {log.levelno for log in logs} == {logging.CRITICAL}
  880. def test_collect_configuration_run_summary_logs_run_umount_error():
  881. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  882. flexmock(module).should_receive('run_configuration').and_return([])
  883. flexmock(module.borg_umount).should_receive('unmount_archive').and_raise(OSError)
  884. flexmock(module).should_receive('log_error_records').and_return(
  885. [logging.makeLogRecord(dict(levelno=logging.CRITICAL, levelname='CRITICAL', msg='Error'))]
  886. )
  887. arguments = {'umount': flexmock(mount_point='/mnt')}
  888. logs = tuple(
  889. module.collect_configuration_run_summary_logs({'test.yaml': {}}, arguments=arguments)
  890. )
  891. assert {log.levelno for log in logs} == {logging.INFO, logging.CRITICAL}
  892. def test_collect_configuration_run_summary_logs_outputs_merged_json_results():
  893. flexmock(module.validate).should_receive('guard_configuration_contains_repository')
  894. flexmock(module).should_receive('run_configuration').and_return(['foo', 'bar']).and_return(
  895. ['baz']
  896. )
  897. stdout = flexmock()
  898. stdout.should_receive('write').with_args('["foo", "bar", "baz"]').once()
  899. flexmock(module.sys).stdout = stdout
  900. arguments = {}
  901. tuple(
  902. module.collect_configuration_run_summary_logs(
  903. {'test.yaml': {}, 'test2.yaml': {}}, arguments=arguments
  904. )
  905. )