Skip to content

Commit af71688

Browse files
authored
CDRIVER-6080 fix stream tracking in /Client/exhaust_cursor/pool (#2110)
* await monitoring connections before proceeding in test
1 parent bd58f9d commit af71688

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/libmongoc/tests/test-mongoc-exhaust.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ test_exhaust_cursor(bool pooled)
115115
pool = test_framework_new_default_client_pool();
116116
stream_tracker_track_pool(st, pool);
117117
client = mongoc_client_pool_pop(pool);
118+
119+
// Wait for all background monitoring connections to be established.
120+
mongoc_uri_t *uri = test_framework_get_uri();
121+
// Server 4.4 added support for streaming monitoring and has 2 monitoring connections.
122+
int monitor_count = test_framework_get_server_version() >= test_framework_str_to_version("4.4") ? 2 : 1;
123+
const mongoc_host_list_t *hosts = mongoc_uri_get_hosts(uri);
124+
while (hosts) {
125+
stream_tracker_assert_eventual_active_count(st, hosts->host_and_port, monitor_count);
126+
hosts = hosts->next;
127+
}
128+
mongoc_uri_destroy(uri);
118129
} else {
119130
client = test_framework_new_default_client();
120131
stream_tracker_track_client(st, client);

0 commit comments

Comments
 (0)