@@ -840,6 +840,8 @@ mod tests {
840
840
unsafe { cass_future_free ( fut) } ;
841
841
}
842
842
843
+ /// A set of rules that are needed to negotiate connections.
844
+ // All connections are successfully negotiated.
843
845
fn handshake_rules ( ) -> impl IntoIterator < Item = RequestRule > {
844
846
[
845
847
RequestRule (
@@ -868,6 +870,23 @@ mod tests {
868
870
) ]
869
871
}
870
872
873
+ /// A set of rules that are needed to finish session initialization.
874
+ // They are used in tests that require a session to be connected.
875
+ // All connections are successfully negotiated.
876
+ // All requests are replied with a server error.
877
+ fn mock_init_rules ( ) -> impl IntoIterator < Item = RequestRule > {
878
+ handshake_rules ( )
879
+ . into_iter ( )
880
+ . chain ( std:: iter:: once ( RequestRule (
881
+ Condition :: RequestOpcode ( RequestOpcode :: Query )
882
+ . or ( Condition :: RequestOpcode ( RequestOpcode :: Prepare ) )
883
+ . or ( Condition :: RequestOpcode ( RequestOpcode :: Batch ) ) ,
884
+ // We won't respond to any queries (including metadata fetch),
885
+ // but the driver will manage to continue with dummy metadata.
886
+ RequestReaction :: forge ( ) . server_error ( ) ,
887
+ ) ) )
888
+ }
889
+
871
890
pub ( crate ) async fn test_with_one_proxy (
872
891
test : impl FnOnce ( SocketAddr , RunningProxy ) -> RunningProxy + Send + ' static ,
873
892
rules : impl IntoIterator < Item = RequestRule > ,
0 commit comments