@@ -981,6 +981,58 @@ _mock_server_receives_msg (mock_server_t *server, uint32_t flags, ...)
981
981
return request ;
982
982
}
983
983
984
+
985
+ /*--------------------------------------------------------------------------
986
+ *
987
+ * mock_server_receives_bulk_msg --
988
+ *
989
+ * Pop a client OP_MSG request if one is enqueued, or wait up to
990
+ * request_timeout_ms for the client to send a request. Pass varargs
991
+ * list of bson_t pointers, which are matched to the series of
992
+ * documents in the request, regardless of section boundaries.
993
+ *
994
+ * Returns:
995
+ * A request you must request_destroy, or NULL if the request does not
996
+ * match.
997
+ *
998
+ * Side effects:
999
+ * Logs and aborts if the current request is not an OP_MSG matching
1000
+ * flags and expected pattern and number of documents.
1001
+ *
1002
+ *--------------------------------------------------------------------------
1003
+ */
1004
+ request_t *
1005
+ mock_server_receives_bulk_msg (mock_server_t * server ,
1006
+ uint32_t flags ,
1007
+ const bson_t * msg_pattern ,
1008
+ const bson_t * doc_pattern ,
1009
+ size_t n_docs )
1010
+ {
1011
+ request_t * request ;
1012
+ bool r ;
1013
+
1014
+ request = mock_server_receives_request (server );
1015
+
1016
+ {
1017
+ const bson_t * * docs ;
1018
+ size_t i ;
1019
+ docs = bson_malloc (n_docs * sizeof (bson_t * ));
1020
+ docs [0 ] = msg_pattern ;
1021
+ for (i = 1 ; i < n_docs ; ++ i ) {
1022
+ docs [i ] = doc_pattern ;
1023
+ }
1024
+ r = request_matches_msg (request , MONGOC_MSG_NONE , docs , n_docs );
1025
+ bson_free ((bson_t * * ) docs );
1026
+ }
1027
+
1028
+ if (!r ) {
1029
+ request_destroy (request );
1030
+ return NULL ;
1031
+ }
1032
+
1033
+ return request ;
1034
+ }
1035
+
984
1036
/*--------------------------------------------------------------------------
985
1037
*
986
1038
* mock_server_receives_hello --
0 commit comments