File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -356,16 +356,25 @@ mod tests {
356356
357357 #[ graph:: test]
358358 async fn polling_monitor_cancelation ( ) {
359+ const REQ : & str = "req-0" ;
360+
359361 // Cancelation on receiver drop, no pending request.
360362 let ( mut handle, _monitor, rx) = setup ( ) ;
361363 drop ( rx) ;
362364 assert ! ( handle. next_request( ) . await . is_none( ) ) ;
363365
364366 // Cancelation on receiver drop, with pending request.
365367 let ( mut handle, monitor, rx) = setup ( ) ;
366- monitor. monitor ( "req-0" ) ;
368+ monitor. monitor ( REQ ) ;
367369 drop ( rx) ;
368- assert ! ( handle. next_request( ) . await . is_none( ) ) ;
370+ let mut next = handle. next_request ( ) . await ;
371+ if let Some ( ( a, _) ) = next {
372+ // The request may or may not have been pulled from the queue
373+ // before cancelation.
374+ assert_eq ! ( REQ , a) ;
375+ next = handle. next_request ( ) . await ;
376+ }
377+ assert ! ( next. is_none( ) ) ;
369378
370379 // Cancelation on receiver drop, while queue is waiting.
371380 let ( mut handle, _monitor, rx) = setup ( ) ;
You can’t perform that action at this time.
0 commit comments