@@ -629,7 +629,7 @@ get_bson_from_json_file (char *filename)
629
629
}
630
630
631
631
static bool
632
- check_version_info (const bson_t * scenario )
632
+ check_version_info (const bson_t * scenario , bool print_reason )
633
633
{
634
634
const char * s ;
635
635
char * padded ;
@@ -643,7 +643,7 @@ check_version_info (const bson_t *scenario)
643
643
bson_free (padded );
644
644
server_version = test_framework_get_server_version ();
645
645
if (server_version > test_version ) {
646
- if (test_suite_debug_output ()) {
646
+ if (print_reason && test_suite_debug_output ()) {
647
647
printf (" SKIP, maxServerVersion=\"%s\"\n" , s );
648
648
fflush (stdout );
649
649
}
@@ -657,7 +657,7 @@ check_version_info (const bson_t *scenario)
657
657
test_version = test_framework_str_to_version (s );
658
658
server_version = test_framework_get_server_version ();
659
659
if (server_version < test_version ) {
660
- if (test_suite_debug_output ()) {
660
+ if (print_reason && test_suite_debug_output ()) {
661
661
printf (" SKIP, minServerVersion=\"%s\"\n" , s );
662
662
fflush (stdout );
663
663
}
@@ -698,8 +698,11 @@ check_version_info (const bson_t *scenario)
698
698
}
699
699
700
700
/* If we didn't match any of the listed topologies, skip */
701
- printf (" SKIP, test topologies do not match current %s setup\n" ,
702
- current_topology );
701
+ if (print_reason && test_suite_debug_output ()) {
702
+ printf (" SKIP, test topologies do not match current %s setup\n" ,
703
+ current_topology );
704
+ fflush (stdout );
705
+ }
703
706
704
707
return false;
705
708
}
@@ -721,15 +724,20 @@ check_scenario_version (const bson_t *scenario)
721
724
722
725
while (bson_iter_next (& iter )) {
723
726
bson_iter_bson (& iter , & version_info );
724
- if (check_version_info (& version_info )) {
727
+ if (check_version_info (& version_info , false )) {
725
728
return true;
726
729
}
727
730
}
728
731
732
+ if (test_suite_debug_output ()) {
733
+ printf (" SKIP, no matching topologies in runOn\n" );
734
+ fflush (stdout );
735
+ }
736
+
729
737
return false;
730
738
}
731
739
732
- return check_version_info (scenario );
740
+ return check_version_info (scenario , true );
733
741
}
734
742
735
743
@@ -989,17 +997,18 @@ execute_test (const json_test_config_t *config,
989
997
collection -> client -> topology , MONGOC_SS_WRITE , NULL , & error );
990
998
ASSERT_OR_PRINT (server_id , error );
991
999
992
- if (bson_has_field (test , "failPoint" )) {
993
- activate_fail_point (client , server_id , test , "failPoint" );
994
- }
995
-
996
1000
json_test_ctx_init (& ctx , test , client , db , collection , config );
997
- set_apm_callbacks (& ctx , collection -> client );
998
1001
999
1002
if (config -> before_test_cb ) {
1000
1003
config -> before_test_cb (& ctx , test );
1001
1004
}
1002
1005
1006
+ if (bson_has_field (test , "failPoint" )) {
1007
+ activate_fail_point (client , server_id , test , "failPoint" );
1008
+ }
1009
+
1010
+ set_apm_callbacks (& ctx , collection -> client );
1011
+
1003
1012
json_test_operations (& ctx , test );
1004
1013
1005
1014
if (config -> after_test_cb ) {
@@ -1138,6 +1147,9 @@ set_uri_opts_from_bson (mongoc_uri_t *uri, const bson_t *opts)
1138
1147
} else if (!strcmp (bson_iter_key (& iter ), "retryWrites" )) {
1139
1148
mongoc_uri_set_option_as_bool (
1140
1149
uri , "retryWrites" , bson_iter_bool (& iter ));
1150
+ } else if (!strcmp (bson_iter_key (& iter ), "heartbeatFrequencyMS" )) {
1151
+ mongoc_uri_set_option_as_int32 (
1152
+ uri , "heartbeatFrequencyMS" , bson_iter_int32 (& iter ));
1141
1153
} else {
1142
1154
MONGOC_ERROR ("Unsupported clientOptions field \"%s\" in %s" ,
1143
1155
bson_iter_key (& iter ),
@@ -1148,6 +1160,44 @@ set_uri_opts_from_bson (mongoc_uri_t *uri, const bson_t *opts)
1148
1160
}
1149
1161
1150
1162
1163
+ static bool
1164
+ _should_skip_due_to_server_39704 (const bson_t * test )
1165
+ {
1166
+ const char * desc = bson_lookup_utf8 (test , "description" );
1167
+ const char * bad_tests [] = {
1168
+ "only first countDocuments includes readConcern" ,
1169
+ "only first find includes readConcern" ,
1170
+ "only first aggregate includes readConcern" ,
1171
+ "only first distinct includes readConcern" ,
1172
+ "only first runCommand includes readConcern" ,
1173
+ "transaction options inherited from defaultTransactionOptions" ,
1174
+ "startTransaction options override defaults" ,
1175
+ "defaultTransactionOptions override client options" ,
1176
+ "readConcern snapshot in startTransaction options" ,
1177
+ "withTransaction inherits transaction options from "
1178
+ "defaultTransactionOptions" ,
1179
+ "withTransaction explicit transaction options" ,
1180
+ "withTransaction explicit transaction options override "
1181
+ "defaultTransactionOptions" ,
1182
+ "withTransaction explicit transaction options override client options" };
1183
+ int i ;
1184
+
1185
+ /* Only an issue for sharded clusters. */
1186
+ if (!test_framework_is_mongos ()) {
1187
+ return false;
1188
+ }
1189
+
1190
+ for (i = 0 ; i < sizeof (bad_tests ) / sizeof (char * ); i ++ ) {
1191
+ if (0 == strcmp (desc , bad_tests [i ])) {
1192
+ return true;
1193
+ }
1194
+ }
1195
+
1196
+
1197
+ return false;
1198
+ }
1199
+
1200
+
1151
1201
/*
1152
1202
*-----------------------------------------------------------------------
1153
1203
*
@@ -1221,13 +1271,22 @@ run_json_general_test (const json_test_config_t *config)
1221
1271
continue ;
1222
1272
}
1223
1273
1274
+ if (_should_skip_due_to_server_39704 (& test )) {
1275
+ fprintf (stderr ,
1276
+ " - %s SKIPPED, reason: SERVER-39704 causes sharded tests to "
1277
+ "fail when using readConcern: snapshot\n" ,
1278
+ description );
1279
+ continue ;
1280
+ }
1281
+
1224
1282
bson_free (selected_test );
1225
1283
1226
1284
uri = test_framework_get_uri ();
1227
1285
1228
- /* If we are using multiple mongos, hardcode them in, for now,
1229
- but keep the other URI components (CDRIVER-3285) */
1230
- if (bson_iter_init_find (& uri_iter , & test , "useMultipleMongoses" )) {
1286
+ /* If we are using multiple mongos, hardcode them in, for now, but keep
1287
+ * the other URI components (CDRIVER-3285) */
1288
+ if (bson_iter_init_find (& uri_iter , & test , "useMultipleMongoses" ) &&
1289
+ bson_iter_as_bool (& uri_iter )) {
1231
1290
ASSERT_OR_PRINT (
1232
1291
mongoc_uri_upsert_host_and_port (uri , "localhost:27017" , & error ),
1233
1292
error );
0 commit comments