@@ -1268,35 +1268,41 @@ session_test_destroy (session_test_t *test)
1268
1268
1269
1269
1270
1270
static void
1271
- check_success_no_commands (session_test_t * test )
1271
+ check_sessions_from_same_client_enforced (session_test_t * test )
1272
1272
{
1273
1273
if (test -> session_client != test -> client ) {
1274
1274
BSON_ASSERT (!test -> succeeded );
1275
1275
ASSERT_ERROR_CONTAINS (test -> error ,
1276
1276
MONGOC_ERROR_COMMAND ,
1277
1277
MONGOC_ERROR_COMMAND_INVALID_ARG ,
1278
1278
"Invalid sessionId" );
1279
-
1280
- return ;
1281
1279
}
1280
+ }
1281
+
1282
1282
1283
+ static void
1284
+ check_sessions_with_w0_prohibited (session_test_t * test )
1285
+ {
1283
1286
if (test -> expect_explicit_lsid && !test -> acknowledged ) {
1284
1287
BSON_ASSERT (!test -> succeeded );
1285
1288
ASSERT_ERROR_CONTAINS (test -> error ,
1286
1289
MONGOC_ERROR_COMMAND ,
1287
1290
MONGOC_ERROR_COMMAND_INVALID_ARG ,
1288
1291
"session with unacknowledged" );
1289
- return ;
1290
1292
}
1291
-
1292
- ASSERT_OR_PRINT (test -> succeeded , test -> error );
1293
1293
}
1294
1294
1295
1295
1296
1296
static void
1297
1297
check_success (session_test_t * test )
1298
1298
{
1299
- check_success_no_commands (test );
1299
+ check_sessions_from_same_client_enforced (test );
1300
+ check_sessions_with_w0_prohibited (test );
1301
+
1302
+ if (test -> session_client == test -> client &&
1303
+ test -> expect_explicit_lsid == test -> acknowledged ) {
1304
+ ASSERT_OR_PRINT (test -> succeeded , test -> error );
1305
+ }
1300
1306
1301
1307
if (test -> succeeded ) {
1302
1308
ASSERT_CMPINT (test -> n_started , > , 0 );
@@ -2015,22 +2021,23 @@ test_bulk (session_test_t *test)
2015
2021
2016
2022
test -> succeeded = mongoc_bulk_operation_insert_with_opts (
2017
2023
bulk , tmp_bson ("{}" ), NULL , & test -> error );
2018
- check_success_no_commands (test );
2024
+ check_sessions_from_same_client_enforced (test );
2019
2025
2020
2026
test -> succeeded = mongoc_bulk_operation_update_one_with_opts (
2021
2027
bulk ,
2022
2028
tmp_bson ("{}" ),
2023
2029
tmp_bson ("{'$set': {'x': 1}}" ),
2024
2030
NULL ,
2025
2031
& test -> error );
2026
- check_success_no_commands (test );
2032
+ check_sessions_from_same_client_enforced (test );
2027
2033
2028
2034
test -> succeeded = mongoc_bulk_operation_remove_one_with_opts (
2029
2035
bulk , tmp_bson ("{}" ), NULL , & test -> error );
2030
- check_success_no_commands (test );
2036
+ check_sessions_from_same_client_enforced (test );
2031
2037
2032
2038
i = mongoc_bulk_operation_execute (bulk , NULL , & test -> error );
2033
2039
test -> succeeded = (i != 0 );
2040
+ check_sessions_with_w0_prohibited (test );
2034
2041
2035
2042
mongoc_bulk_operation_destroy (bulk );
2036
2043
}
@@ -2621,6 +2628,30 @@ test_session_install (TestSuite *suite)
2621
2628
test_insert_one ,
2622
2629
false,
2623
2630
false);
2631
+ add_unacknowledged_test (
2632
+ suite ,
2633
+ "/Session/unacknowledged/bulk/explicit_cs/inherit_wc" ,
2634
+ test_bulk ,
2635
+ true,
2636
+ true);
2637
+ add_unacknowledged_test (
2638
+ suite ,
2639
+ "/Session/unacknowledged/bulk/explicit_cs/explicit_wc" ,
2640
+ test_bulk ,
2641
+ true,
2642
+ false);
2643
+ add_unacknowledged_test (
2644
+ suite ,
2645
+ "/Session/unacknowledged/bulk/implicit_cs/inherit_wc" ,
2646
+ test_bulk ,
2647
+ false,
2648
+ true);
2649
+ add_unacknowledged_test (
2650
+ suite ,
2651
+ "/Session/unacknowledged/bulk/implicit_cs/explicit_wc" ,
2652
+ test_bulk ,
2653
+ false,
2654
+ false);
2624
2655
/* find_and_modify_with_opts only inherits acknowledged write concerns, so
2625
2656
* skip tests that inherit a write concern. Technically, an explicit
2626
2657
* unacknowledged write concern doesn't make much sense with findAndModify,
0 commit comments