@@ -9,7 +9,6 @@ pub(crate) mod shared_client_tests {
99 use glide_core:: client:: { Client , DEFAULT_RESPONSE_TIMEOUT } ;
1010 use redis:: {
1111 cluster_routing:: { MultipleNodeRoutingInfo , RoutingInfo } ,
12- cluster_topology:: get_slot,
1312 FromRedisValue , InfoDict , RedisConnectionInfo , Value ,
1413 } ;
1514 use rstest:: rstest;
@@ -399,7 +398,6 @@ pub(crate) mod shared_client_tests {
399398 let result = test_basics. client . send_command ( & cmd, None ) . await ;
400399 assert ! ( result. is_err( ) ) ;
401400 let err = result. unwrap_err ( ) ;
402- println ! ( "{:?}" , err) ;
403401 assert_eq ! ( err. kind( ) , redis:: ErrorKind :: ResponseError ) ;
404402 assert ! ( err. to_string( ) . contains( "negative" ) ) ;
405403 } ) ;
@@ -410,8 +408,7 @@ pub(crate) mod shared_client_tests {
410408 fn test_blocking_command_with_zero_timeout_blocks_indefinitely (
411409 #[ values( false , true ) ] use_cluster : bool ,
412410 ) {
413- //"We test that when a blocking command is passed with a timeout duration of 0, it will block the client indefinitely
414- use redis:: cluster_routing:: { Route , SingleNodeRoutingInfo , SlotAddr } ;
411+ // We test that when a blocking command is passed with a timeout duration of 0, it will block the client indefinitely
415412 block_on_all ( async {
416413 let config = TestConfiguration {
417414 request_timeout : Some ( 1 ) , // millisecond
@@ -420,49 +417,15 @@ pub(crate) mod shared_client_tests {
420417 } ;
421418 let mut test_basics = setup_test_basics ( use_cluster, config. clone ( ) ) . await ;
422419 let key = generate_random_string ( 10 ) ;
423- // We're routing the request to specific node to verify later that BLPOP wasn't completed on that node
424- let routing = if use_cluster {
425- Some ( RoutingInfo :: SingleNode (
426- SingleNodeRoutingInfo :: SpecificNode ( Route :: new (
427- get_slot ( key. as_bytes ( ) ) ,
428- SlotAddr :: Master ,
429- ) ) ,
430- ) )
431- } else {
432- None
433- } ;
434- let get_blpop_cmdstats = |mut client : Client , routing : Option < RoutingInfo > | async move {
435- let mut cmd = redis:: Cmd :: new ( ) ;
436- cmd. arg ( "INFO" ) . arg ( "ALL" ) ;
437- let info_res: Value = client
438- . send_command ( & cmd, routing)
439- . await
440- . expect ( "Failed to get INFO ALL" ) ;
441- let res_str = redis:: from_owned_redis_value :: < String > ( info_res)
442- . expect ( "INFO ALL result isn't string" ) ;
443- res_str
444- . lines ( )
445- . filter ( |line| line. contains ( "cmdstat_blpop" ) )
446- . collect :: < String > ( )
447- } ;
448- let blpop_stats_before =
449- get_blpop_cmdstats ( test_basics. client . clone ( ) , routing. clone ( ) ) . await ;
450- let cloned_routing = routing. clone ( ) ;
451420 let future = async move {
452421 let mut cmd = redis:: Cmd :: new ( ) ;
453422 cmd. arg ( "BLPOP" ) . arg ( key) . arg ( 0 ) ; // `0` should block indefinitely
454- test_basics. client . send_command ( & cmd, cloned_routing ) . await
423+ test_basics. client . send_command ( & cmd, None ) . await
455424 } ;
456425 // We execute the command with Tokio's timeout wrapper to prevent the test from hanging indefinitely.
457426 let tokio_timeout_result =
458427 tokio:: time:: timeout ( DEFAULT_RESPONSE_TIMEOUT * 2 , future) . await ;
459428 assert ! ( tokio_timeout_result. is_err( ) ) ;
460- // Verify that BLPOP command wasn't completed.
461- // We create a new client since the connection in the existing client should be blocked
462- let new_client = create_client ( & test_basics. server , config) . await ;
463- let blpop_stats_after = get_blpop_cmdstats ( new_client, routing) . await ;
464- assert_eq ! ( blpop_stats_before, blpop_stats_after,
465- "BLPOP command statistiscs has been changed. Before: {blpop_stats_before}, After: {blpop_stats_after}" ) ;
466429 } ) ;
467430 }
468431
0 commit comments