@@ -663,11 +663,13 @@ async fn timeout_behavior_with_deadline() {
663663 . expect ( "failed to bind black-hole listener" ) ;
664664 let hung_port = listener. local_addr ( ) . unwrap ( ) . port ( ) ;
665665
666- // Accept connections but never write any bytes — the HTTP/2 handshake stalls.
666+ // Accept one connection but never write any bytes — the HTTP/2 handshake stalls.
667+ // A single connection is all the test needs (one RPC → one connection).
667668 tokio:: spawn ( async move {
668- let mut held_sockets = Vec :: new ( ) ;
669- while let Ok ( ( socket, _) ) = listener. accept ( ) . await {
670- held_sockets. push ( socket) ; // keep alive but silent
669+ if let Ok ( ( socket, _) ) = listener. accept ( ) . await {
670+ // Hold the socket open without responding so the timeout fires.
671+ let _socket = socket;
672+ tokio:: time:: sleep ( std:: time:: Duration :: from_secs ( 5 ) ) . await ;
671673 }
672674 } ) ;
673675
@@ -785,16 +787,23 @@ async fn watch_resume_after_checkpoint() {
785787
786788 // The resumed event must include the post-checkpoint write for this test,
787789 // and must not replay the pre-checkpoint write.
788- let updates_debug = format ! ( "{:?}" , event. updates) ;
790+ let has_resume_2 = event. updates . iter ( ) . any ( |u| {
791+ u. relationship . resource . object_id ( ) == "resume-2"
792+ && u. relationship . resource . object_type ( ) == "document"
793+ } ) ;
794+ let has_resume_1 = event. updates . iter ( ) . any ( |u| {
795+ u. relationship . resource . object_id ( ) == "resume-1"
796+ && u. relationship . resource . object_type ( ) == "document"
797+ } ) ;
789798 assert ! (
790- updates_debug . contains ( "resume-2" ) ,
791- "resumed watch should include the post-checkpoint update; got: {}" ,
792- updates_debug
799+ has_resume_2 ,
800+ "resumed watch should include the post-checkpoint update (resume-2) ; got: {:? }" ,
801+ event . updates
793802 ) ;
794803 assert ! (
795- !updates_debug . contains ( "resume-1" ) ,
796- "resumed watch should not replay the pre-checkpoint update; got: {}" ,
797- updates_debug
804+ !has_resume_1 ,
805+ "resumed watch should not replay the pre-checkpoint update (resume-1) ; got: {:? }" ,
806+ event . updates
798807 ) ;
799808}
800809
0 commit comments