@@ -879,43 +879,46 @@ test_mongoc_uri_long_hostname (void)
879
879
bson_free (host_and_port );
880
880
bson_free (host );
881
881
}
882
+
883
+ static void
882
884
test_mongoc_uri_local_threshold_ms (void )
883
885
{
884
886
mongoc_uri_t * uri ;
885
887
886
888
uri = mongoc_uri_new ("mongodb://localhost/" );
887
889
888
890
/* localthresholdms isn't set, return the default */
889
- ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = ,
890
- MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS );
891
- ASSERT (
891
+ ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ),
892
+ = = , MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS );
893
+ ASSERT (
892
894
mongoc_uri_set_option_as_int32 (uri , "localthresholdms" , 99 ));
893
895
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = , 99 );
894
896
895
- mongoc_uri_destroy (uri );
897
+ mongoc_uri_destroy (uri );
896
898
897
899
898
- uri = mongoc_uri_new ("mongodb://localhost/?localthresholdms=0" );
900
+ uri = mongoc_uri_new (
901
+ "mongodb://localhost/?localthresholdms=0" );
899
902
900
903
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = , 0 );
901
904
ASSERT (
902
905
mongoc_uri_set_option_as_int32 (uri , "localthresholdms" , 99 ));
903
906
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = , 99 );
904
907
905
- mongoc_uri_destroy (uri );
906
-
908
+ mongoc_uri_destroy (uri );
907
909
908
- uri = mongoc_uri_new (
909
- "mongodb://localhost/?" MONGOC_URI_LOCALTHRESHOLDMS "=-1" );
910
+ uri = mongoc_uri_new ("mongodb://localhost/?localthresholdms=-1" );
910
911
911
912
/* localthresholdms is invalid, return the default */
912
913
capture_logs (true);
913
- ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = ,
914
- MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS );
914
+ ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ),
915
+ = = ,
916
+ MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS );
915
917
ASSERT_CAPTURED_LOG ("mongoc_uri_get_local_threshold_option" ,
916
- MONGOC_LOG_LEVEL_WARNING , "Invalid localThresholdMS: -1" );
918
+ MONGOC_LOG_LEVEL_WARNING ,
919
+ "Invalid localThresholdMS: -1" );
917
920
918
- mongoc_uri_destroy (uri );
921
+ mongoc_uri_destroy (uri );
919
922
}
920
923
921
924
@@ -932,5 +935,6 @@ test_uri_install (TestSuite *suite)
932
935
TestSuite_Add (suite , "/Uri/functions" , test_mongoc_uri_functions );
933
936
TestSuite_Add (suite , "/Uri/compound_setters" , test_mongoc_uri_compound_setters );
934
937
TestSuite_Add (suite , "/Uri/long_hostname" , test_mongoc_uri_long_hostname );
935
- TestSuite_Add (suite , "/Uri/local_threshold_ms" , test_mongoc_uri_local_threshold_ms );
938
+ TestSuite_Add (
939
+ suite , "/Uri/local_threshold_ms" , test_mongoc_uri_local_threshold_ms );
936
940
}
0 commit comments