@@ -239,9 +239,43 @@ def test_disabled_command_run():
239
239
verify (opengrok_tools .utils .mirror ).run_command (ANY , project_name )
240
240
241
241
242
+ @pytest .mark .parametrize ("per_project" , [True , False ])
243
+ def test_ignore_errors_sync (monkeypatch , per_project ):
244
+ """
245
+ Test that ignore errors overrides failed repository sync().
246
+ """
247
+
248
+ mock_repo = mock (spec = GitRepository )
249
+ when (mock_repo ).sync ().thenReturn (FAILURE_EXITVAL )
250
+
251
+ def mock_get_repos (* args , ** kwargs ):
252
+ return [mock_repo ]
253
+
254
+ project_name = "foo"
255
+ if per_project :
256
+ config = {
257
+ PROJECTS_PROPERTY : {
258
+ project_name : {IGNORE_ERR_PROPERTY : True }
259
+ }
260
+ }
261
+ else :
262
+ config = {
263
+ IGNORE_ERR_PROPERTY : True ,
264
+ }
265
+
266
+ with monkeypatch .context () as m :
267
+ mock_get_repos .called = False
268
+ m .setattr ("opengrok_tools.utils.mirror.get_repos_for_project" ,
269
+ mock_get_repos )
270
+
271
+ src_root = "srcroot"
272
+ assert mirror_project (config , project_name , False ,
273
+ None , src_root ) == SUCCESS_EXITVAL
274
+
275
+
242
276
@pytest .mark .parametrize ("hook_type" , [HOOK_PRE_PROPERTY , HOOK_POST_PROPERTY ])
243
277
@pytest .mark .parametrize ("per_project" , [True , False ])
244
- def test_ignore_errors (monkeypatch , hook_type , per_project ):
278
+ def test_ignore_errors_hooks (monkeypatch , hook_type , per_project ):
245
279
"""
246
280
Test that ignore errors property overrides failed hook.
247
281
"""
0 commit comments