Skip to content

Commit 24d880e

Browse files
committed
CDRIVER-2060 localThreshold code cleanups
1 parent e353c3e commit 24d880e

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/mongoc/mongoc-uri.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,6 @@ mongoc_uri_get_local_threshold_option (const mongoc_uri_t *uri)
12631263
if ((options = mongoc_uri_get_options (uri)) &&
12641264
bson_iter_init_find_case (&iter, options, "localthresholdms") &&
12651265
BSON_ITER_HOLDS_INT32 (&iter)) {
1266-
12671266
retval = bson_iter_int32 (&iter);
12681267

12691268
if (retval < 0) {

tests/test-mongoc-uri.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,44 +1064,44 @@ test_mongoc_uri_long_hostname (void)
10641064
bson_free (host);
10651065
}
10661066

1067+
static void
10671068
test_mongoc_uri_local_threshold_ms (void)
10681069
{
10691070
mongoc_uri_t *uri;
10701071

10711072
uri = mongoc_uri_new ("mongodb://localhost/");
10721073

10731074
/* localthresholdms isn't set, return the default */
1074-
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri), ==,
1075-
MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS);
1076-
ASSERT (
1075+
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri),
1076+
==,MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS);
1077+
ASSERT (
10771078
mongoc_uri_set_option_as_int32 (uri, "localthresholdms", 99));
10781079
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri), ==, 99);
10791080

1080-
mongoc_uri_destroy(uri);
1081-
1081+
mongoc_uri_destroy (uri);
10821082

1083-
uri = mongoc_uri_new (
1084-
"mongodb://localhost/?localthresholdms=0");
1083+
uri =
1084+
mongoc_uri_new ("mongodb://localhost/?localthresholdms=0");
10851085

10861086
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri), ==, 0);
10871087
ASSERT (
10881088
mongoc_uri_set_option_as_int32 (uri, "localthresholdms", 99));
10891089
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri), ==, 99);
10901090

1091-
mongoc_uri_destroy(uri);
1092-
1091+
mongoc_uri_destroy (uri);
10931092

1094-
uri = mongoc_uri_new(
1095-
"mongodb://localhost/?" MONGOC_URI_LOCALTHRESHOLDMS "=-1");
1093+
uri = mongoc_uri_new ("mongodb://localhost/?localthresholdms=-1");
10961094

10971095
/* localthresholdms is invalid, return the default */
10981096
capture_logs (true);
1099-
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri), ==,
1100-
MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS);
1097+
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri),
1098+
==,
1099+
MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS);
11011100
ASSERT_CAPTURED_LOG ("mongoc_uri_get_local_threshold_option",
1102-
MONGOC_LOG_LEVEL_WARNING, "Invalid localThresholdMS: -1");
1101+
MONGOC_LOG_LEVEL_WARNING,
1102+
"Invalid localThresholdMS: -1");
11031103

1104-
mongoc_uri_destroy(uri);
1104+
mongoc_uri_destroy (uri);
11051105
}
11061106

11071107
void
@@ -1123,5 +1123,6 @@ test_uri_install (TestSuite *suite)
11231123
TestSuite_Add (
11241124
suite, "/Uri/compound_setters", test_mongoc_uri_compound_setters);
11251125
TestSuite_Add (suite, "/Uri/long_hostname", test_mongoc_uri_long_hostname);
1126-
TestSuite_Add (suite, "/Uri/local_threshold_ms", test_mongoc_uri_local_threshold_ms);
1126+
TestSuite_Add (
1127+
suite, "/Uri/local_threshold_ms", test_mongoc_uri_local_threshold_ms);
11271128
}

0 commit comments

Comments
 (0)