@@ -266,18 +266,34 @@ def verified(argv, **kwargs):
266266 with self .assertRaisesRegex (network .NetworkError , 'attested' ):
267267 broker ['recover' ](self .root , None )
268268
269- def test_failure_and_cancellation_abort_rendezvous (self ):
270- for current , jobs in ((dict (run_attempt = 3 ), None ), (dict (run_attempt = 2 , conclusion = 'cancelled' ), None ),
271- (dict (run_attempt = 2 , status = 'completed' ), None ),
272- (dict (run_attempt = 2 ), dict (total_count = 1 , jobs = [dict (name = 'Interoperability / NetBSD' , conclusion = 'failure' )]))):
273- responses = [current ] if jobs is None else [current , jobs ]
269+ def test_cancelled_or_superseded_ci_aborts_rendezvous (self ):
270+ for current in (dict (run_attempt = 3 ), dict (run_attempt = 2 , conclusion = 'cancelled' ),
271+ dict (run_attempt = 2 , status = 'completed' )):
274272 def downloading (* args , ** kwargs ):
275273 kwargs ['progress' ]()
276274 self .fail ('Failed CI did not abort' )
277- with self .subTest (current = current , jobs = jobs ), patch .object (ci , 'api' , side_effect = responses ), \
275+ with self .subTest (current = current ), patch .object (ci , 'api' , return_value = current ), \
278276 patch .object (ci , 'download_records' , side_effect = downloading ), patch .object (time , 'monotonic' , return_value = 100 ):
279- with self .assertRaises (network .NetworkError ):
277+ with self .assertRaises (network .NetworkError ) as caught :
280278 ci .records ('ready' )
279+ self .assertNotIsInstance (caught .exception , ci .PeerUnavailable )
280+
281+ def test_failed_peer_blocks_rendezvous (self ):
282+ def downloading (* args , ** kwargs ):
283+ kwargs ['progress' ]()
284+ self .fail ('Missing peer did not block the phase' )
285+ for conclusion in ('failure' , 'cancelled' , 'timed_out' , 'action_required' ):
286+ jobs = dict (total_count = 1 , jobs = [dict (name = 'Interoperability / NetBSD' , conclusion = conclusion )])
287+ with self .subTest (conclusion = conclusion ), patch .object (ci , 'api' , side_effect = [dict (run_attempt = 2 ), jobs ]), \
288+ patch .object (ci , 'download_records' , side_effect = downloading ), patch .object (time , 'monotonic' , return_value = 100 ), \
289+ self .assertRaisesRegex (ci .PeerUnavailable , 'NetBSD' ):
290+ ci .records ('ready' )
291+
292+ def test_failed_controller_blocks_its_dependants (self ):
293+ for conclusion in ('failure' , 'cancelled' , 'timed_out' ):
294+ with self .subTest (conclusion = conclusion ), patch .object (ci , 'find_controller' , return_value = dict (conclusion = conclusion )), \
295+ self .assertRaisesRegex (ci .PeerUnavailable , 'Network controller failed' ):
296+ ci .controller ()
281297
282298 def test_invalid_recovery_lease_never_reaches_cleanup (self ):
283299 run = dict (id = 456 , run_attempt = 1 , path = '.github/workflows/interoperability.yml' , head_branch = 'master' ,
0 commit comments