@@ -392,6 +392,51 @@ def test_try_failed(_):
392
392
assert state .try_state == BuildState .FAILURE
393
393
394
394
395
+ @unittest .mock .patch ('homu.pull_req_state.assert_authorized' ,
396
+ side_effect = return_true )
397
+ def test_try_timed_out (_ ):
398
+ """
399
+ Test that a pull request that has been tried shows up as tried
400
+ """
401
+
402
+ state = new_state ()
403
+ result = state .process_event (create_event ({
404
+ 'eventType' : 'IssueComment' ,
405
+ 'author' : {
406
+ 'login' : 'bors' ,
407
+ },
408
+ 'body' : '''
409
+ :hourglass: Trying commit 065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe with merge 330c85d9270b32d7703ebefc337eb37ae959f741...
410
+ <!-- homu: {"type":"TryBuildStarted","head_sha":"065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe","merge_sha":"330c85d9270b32d7703ebefc337eb37ae959f741"} -->
411
+ ''' , # noqa
412
+ 'publishedAt' : '1985-04-21T00:00:00Z' ,
413
+ }))
414
+
415
+ assert result .changed is True
416
+ assert state .try_ is True
417
+ assert state .get_status () == 'pending'
418
+ assert state .build_state == BuildState .NONE
419
+ assert state .try_state == BuildState .PENDING
420
+
421
+ result = state .process_event (create_event ({
422
+ 'eventType' : 'IssueComment' ,
423
+ 'author' : {
424
+ 'login' : 'bors' ,
425
+ },
426
+ 'body' : '''
427
+ :boom: Test timed out
428
+ <!-- homu: {"type":"TimedOut"} -->
429
+ ''' , # noqa
430
+ 'publishedAt' : '1985-04-21T00:01:00Z' ,
431
+ }))
432
+
433
+ assert result .changed is True
434
+ assert state .try_ is True
435
+ assert state .get_status () == 'failure'
436
+ assert state .build_state == BuildState .NONE
437
+ assert state .try_state == BuildState .FAILURE
438
+
439
+
395
440
@unittest .mock .patch ('homu.pull_req_state.assert_authorized' ,
396
441
side_effect = return_true )
397
442
def test_try_reset_by_push (_ ):
0 commit comments