Skip to content

Commit 5ab3877

Browse files
committed
CDRIVER-1433 test that bulk op always inits "reply"
1 parent 2c95f9c commit 5ab3877

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test-bulk.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,22 @@ test_bulk (void)
367367
}
368368

369369

370+
static void
371+
test_bulk_error (void)
372+
{
373+
bson_t reply = { 0 };
374+
bson_error_t error;
375+
mongoc_bulk_operation_t *bulk;
376+
377+
bulk = mongoc_bulk_operation_new (true);
378+
assert (!mongoc_bulk_operation_execute (bulk, &reply, &error));
379+
ASSERT_CMPINT (error.domain, ==, MONGOC_ERROR_COMMAND);
380+
ASSERT_CMPINT (error.code, ==, MONGOC_ERROR_COMMAND_INVALID_ARG);
381+
382+
/* reply was initialized */
383+
ASSERT_CMPUINT32 (reply.len, ==, (uint32_t) 5);
384+
}
385+
370386
static void
371387
test_insert (bool ordered)
372388
{
@@ -3082,6 +3098,8 @@ test_bulk_install (TestSuite *suite)
30823098

30833099
TestSuite_AddLive (suite, "/BulkOperation/basic",
30843100
test_bulk);
3101+
TestSuite_Add (suite, "/BulkOperation/error",
3102+
test_bulk_error);
30853103
TestSuite_AddLive (suite, "/BulkOperation/insert_ordered",
30863104
test_insert_ordered);
30873105
TestSuite_AddLive (suite, "/BulkOperation/insert_unordered",

0 commit comments

Comments
 (0)