Skip to content

Commit e0fc953

Browse files
committed
CDRIVER-2233 change stream test fixes
1 parent bacc87f commit e0fc953

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test-mongoc-change-stream.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ test_change_stream_live_track_resume_token (void *test_ctx)
308308

309309
coll = drop_and_get_coll (client, "db", "coll_resume");
310310
ASSERT (coll);
311+
ASSERT_OR_PRINT (
312+
mongoc_collection_insert_one (coll, tmp_bson (NULL), NULL, NULL, &error),
313+
error);
311314

312315
/* Set the batch size to 1 so we only get one document per call to next. */
313316
stream = mongoc_collection_watch (
@@ -439,6 +442,9 @@ test_change_stream_live_batch_size (void *test_ctx)
439442

440443
coll = drop_and_get_coll (client, "db", "coll_batch");
441444
ASSERT (coll);
445+
ASSERT_OR_PRINT (
446+
mongoc_collection_insert_one (coll, tmp_bson (NULL), NULL, NULL, &err),
447+
err);
442448

443449
stream = mongoc_collection_watch (
444450
coll, tmp_bson ("{}"), tmp_bson ("{'batchSize': 1}"));
@@ -505,6 +511,9 @@ test_change_stream_live_missing_resume_token (void *test_ctx)
505511

506512
coll = drop_and_get_coll (client, "db", "coll_missing_resume");
507513
ASSERT (coll);
514+
ASSERT_OR_PRINT (
515+
mongoc_collection_insert_one (coll, tmp_bson (NULL), NULL, NULL, &err),
516+
err);
508517

509518
stream = mongoc_collection_watch (
510519
coll, tmp_bson ("{'pipeline': [{'$project': {'_id': 0 }}]}"), NULL);
@@ -883,6 +892,9 @@ test_change_stream_live_watch (void *test_ctx)
883892

884893
coll = drop_and_get_coll (client, "db", "coll_watch");
885894
ASSERT (coll);
895+
ASSERT_OR_PRINT (
896+
mongoc_collection_insert_one (coll, tmp_bson (NULL), NULL, NULL, &err),
897+
err);
886898

887899
stream = mongoc_collection_watch (coll, tmp_bson ("{}"), NULL);
888900
ASSERT (stream);
@@ -965,6 +977,9 @@ test_change_stream_live_read_prefs (void *test_ctx)
965977

966978
coll = drop_and_get_coll (client, "db", "coll_read_prefs");
967979
ASSERT (coll);
980+
ASSERT_OR_PRINT (
981+
mongoc_collection_insert_one (coll, tmp_bson (NULL), NULL, NULL, &err),
982+
err);
968983

969984
prefs = mongoc_read_prefs_copy (mongoc_collection_get_read_prefs (coll));
970985
mongoc_read_prefs_set_mode (prefs, MONGOC_READ_SECONDARY);

0 commit comments

Comments
 (0)