@@ -13,7 +13,7 @@ use common::test_utils::{
1313 create_session_with_client, create_test_session,
1414 get_python_executable, is_ipykernel_available,
1515} ;
16- use common:: transport:: { run_communication_test , CommunicationChannel } ;
16+ use common:: transport:: CommunicationChannel ;
1717use common:: TestServer ;
1818use kcserver:: execution_queue:: ExecutionQueue ;
1919use kcshared:: jupyter_message:: { JupyterChannel , JupyterMessage , JupyterMessageHeader } ;
@@ -228,9 +228,9 @@ async fn test_execution_queue_with_real_kernel() {
228228
229229 // Collect all responses to verify execution order
230230 println ! ( "Collecting execution results..." ) ;
231- let timeout = Duration :: from_secs ( 15 ) ;
232- let max_messages = 50 ;
233- let results = run_communication_test ( & mut comm, timeout, max_messages) . await ;
231+ let timeout = Duration :: from_secs ( 25 ) ; // Increased timeout for execution queue test
232+ let max_messages = 100 ; // Increased message limit for execution queue test
233+ let results = run_execution_queue_communication_test ( & mut comm, timeout, max_messages) . await ;
234234
235235 results. print_summary ( ) ;
236236
@@ -283,4 +283,44 @@ fn create_execute_request_with_code(code: &str) -> kcshared::websocket_message::
283283 metadata : json ! ( { } ) ,
284284 buffers : vec ! [ ] ,
285285 } )
286+ }
287+
288+ /// Custom communication test for execution queue that doesn't exit early
289+ async fn run_execution_queue_communication_test (
290+ comm : & mut CommunicationChannel ,
291+ timeout : Duration ,
292+ max_messages : u32 ,
293+ ) -> common:: transport:: CommunicationTestResults {
294+ use common:: transport:: CommunicationTestResults ;
295+
296+ let mut results = CommunicationTestResults :: default ( ) ;
297+ let start_time = std:: time:: Instant :: now ( ) ;
298+
299+ println ! ( "Listening for kernel responses..." ) ;
300+
301+ while start_time. elapsed ( ) < timeout && results. message_count < max_messages {
302+ println ! (
303+ "Waiting for message... (elapsed: {:.1}s)" ,
304+ start_time. elapsed( ) . as_secs_f32( )
305+ ) ;
306+
307+ match comm. receive_message ( ) . await {
308+ Ok ( Some ( text) ) => {
309+ results. process_message ( & text) ;
310+
311+ // For execution queue test, continue collecting until timeout or max messages
312+ // Don't exit early like the standard communication test does
313+ }
314+ Ok ( None ) => {
315+ println ! ( "Communication channel closed" ) ;
316+ break ;
317+ }
318+ Err ( e) => {
319+ println ! ( "Communication error: {}" , e) ;
320+ break ;
321+ }
322+ }
323+ }
324+
325+ results
286326}
0 commit comments