@@ -831,6 +831,69 @@ async fn test_get_tracing_info(session: &Session, ks: String) {
831
831
let tracing_info: TracingInfo = session. get_tracing_info ( & tracing_id) . await . unwrap ( ) ;
832
832
assert ! ( !tracing_info. events. is_empty( ) ) ;
833
833
assert ! ( !tracing_info. nodes( ) . is_empty( ) ) ;
834
+
835
+ // Check if the request type matches
836
+ assert_eq ! ( tracing_info. request. as_ref( ) . unwrap( ) , "Execute CQL3 query" ) ;
837
+
838
+ // Check if we're using Scylla or Cassandra
839
+ let is_scylla = session
840
+ . get_cluster_state ( )
841
+ . get_nodes_info ( )
842
+ . first ( )
843
+ . unwrap ( )
844
+ . sharder ( )
845
+ . is_some ( ) ;
846
+
847
+ if is_scylla {
848
+ // For Scylla, duration should be available immediately
849
+ assert ! ( tracing_info. duration. unwrap( ) > 0 ) ;
850
+ } else {
851
+ // For Cassandra, we might need to wait for the duration
852
+ let mut attempts = 0 ;
853
+ let max_attempts = 10 ;
854
+ let mut duration_opt;
855
+
856
+ while attempts < max_attempts {
857
+ duration_opt = session
858
+ . get_tracing_info ( & tracing_id)
859
+ . await
860
+ . unwrap ( )
861
+ . duration ;
862
+ if let Some ( duration) = duration_opt {
863
+ assert ! ( duration > 0 ) ;
864
+ break ;
865
+ }
866
+ tokio:: time:: sleep ( tokio:: time:: Duration :: from_millis ( 100 ) ) . await ;
867
+ attempts += 1 ;
868
+ }
869
+
870
+ if attempts == max_attempts {
871
+ panic ! ( "Duration was not available after {} attempts" , max_attempts) ;
872
+ }
873
+ }
874
+
875
+ // Verify started_at timestamp is present
876
+ assert ! ( tracing_info. started_at. unwrap( ) . 0 > 0 ) ;
877
+
878
+ // Check parameters
879
+ assert ! ( tracing_info
880
+ . parameters
881
+ . as_ref( )
882
+ . unwrap( )
883
+ . contains_key( "consistency_level" ) ) ;
884
+ assert ! ( tracing_info
885
+ . parameters
886
+ . as_ref( )
887
+ . unwrap( )
888
+ . contains_key( "query" ) ) ;
889
+
890
+ // Check events
891
+ for event in & tracing_info. events {
892
+ assert ! ( !event. activity. as_ref( ) . unwrap( ) . is_empty( ) ) ;
893
+ assert ! ( event. source. is_some( ) ) ;
894
+ assert ! ( event. source_elapsed. unwrap( ) >= 0 ) ;
895
+ assert ! ( !event. activity. as_ref( ) . unwrap( ) . is_empty( ) ) ;
896
+ }
834
897
}
835
898
836
899
async fn test_tracing_query_iter ( session : & Session , ks : String ) {
0 commit comments