@@ -4227,6 +4227,54 @@ test_find_read_concern (void)
4227
4227
mock_server_destroy (server );
4228
4228
}
4229
4229
4230
+ static void
4231
+ test_getmore_read_concern_live (void * ctx )
4232
+ {
4233
+ mongoc_client_t * client ;
4234
+ mongoc_read_concern_t * rc ;
4235
+ mongoc_collection_t * collection ;
4236
+ mongoc_cursor_t * cursor ;
4237
+ mongoc_write_concern_t * wc ;
4238
+ const bson_t * doc ;
4239
+ bson_error_t error ;
4240
+ int i = 0 ;
4241
+
4242
+ client = test_framework_client_new ();
4243
+ collection = get_test_collection (client , "test_read_concern" );
4244
+
4245
+ rc = mongoc_read_concern_new ();
4246
+ mongoc_read_concern_set_level (rc , MONGOC_READ_CONCERN_LEVEL_LOCAL );
4247
+ mongoc_collection_set_read_concern (collection , rc );
4248
+
4249
+
4250
+ wc = mongoc_write_concern_new ();
4251
+ mongoc_write_concern_set_w (wc , MONGOC_WRITE_CONCERN_W_MAJORITY );
4252
+ mongoc_collection_set_write_concern (collection , wc );
4253
+
4254
+ for (i = 5000 ; i > 0 ; i -- ) {
4255
+ mongoc_collection_insert (collection , MONGOC_INSERT_NONE , tmp_bson
4256
+ ("{'a': 1}" ), NULL , NULL );
4257
+ }
4258
+ cursor = mongoc_collection_find_with_opts (collection ,
4259
+ tmp_bson ("{}" ),
4260
+ NULL ,
4261
+ NULL );
4262
+
4263
+ while (mongoc_cursor_next (cursor , & doc )) {
4264
+ i ++ ;
4265
+ }
4266
+ ASSERT_OR_PRINT (!mongoc_cursor_error (cursor , & error ), error );
4267
+
4268
+ ASSERT_CMPINT (i , = = , 5000 );
4269
+ mongoc_cursor_destroy (cursor );
4270
+
4271
+ mongoc_read_concern_destroy (rc );
4272
+ mongoc_write_concern_destroy (wc );
4273
+ mongoc_collection_destroy (collection );
4274
+ mongoc_client_destroy (client );
4275
+ }
4276
+
4277
+
4230
4278
4231
4279
static void
4232
4280
test_aggregate_read_concern (void )
@@ -4600,6 +4648,9 @@ test_collection_install (TestSuite *suite)
4600
4648
TestSuite_AddLive (suite , "/Collection/find_and_modify" , test_find_and_modify );
4601
4649
TestSuite_Add (suite , "/Collection/find_and_modify/write_concern" ,
4602
4650
test_find_and_modify_write_concern_wire_32 );
4651
+ TestSuite_AddFull (suite , "/Collection/getmore_read_concern_live" ,
4652
+ test_getmore_read_concern_live , NULL , NULL ,
4653
+ test_framework_skip_if_max_wire_version_less_than_4 );
4603
4654
TestSuite_Add (suite , "/Collection/find_and_modify/write_concern_pre_32" ,
4604
4655
test_find_and_modify_write_concern_wire_pre_32 );
4605
4656
TestSuite_AddFull (suite , "/Collection/large_return" , test_large_return , NULL , NULL , test_framework_skip_if_slow_or_live );
0 commit comments