Skip to content

Commit d4ba500

Browse files
committed
Simplify the test code command again
Internal isMaster commands should not be compressed, but user triggered isMaster is fair game. We previously had asserts to ensure no non-compressable commands would get compressed, which this check would hit. Now that check has been removed and no longer need for this workaround
1 parent fed9e52 commit d4ba500

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

tests/test-libmongoc.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,6 @@ call_ismaster_with_host_and_port (char *host, uint16_t port, bson_t *reply)
971971
mongoc_uri_t *uri;
972972
mongoc_client_t *client;
973973
bson_error_t error;
974-
mongoc_server_stream_t *server_stream = NULL;
975974

976975
uri_str = bson_strdup_printf ("mongodb://%s:%hu%s",
977976
host,
@@ -997,23 +996,12 @@ call_ismaster_with_host_and_port (char *host, uint16_t port, bson_t *reply)
997996
test_framework_set_ssl_opts (client);
998997
#endif
999998

1000-
1001-
server_stream =
1002-
mongoc_cluster_stream_for_reads (&client->cluster, NULL, &error);
1003-
if (!server_stream ||
1004-
!mongoc_cluster_run_command_private (&client->cluster,
1005-
server_stream->stream,
1006-
0,
1007-
MONGOC_QUERY_SLAVE_OK,
1008-
"admin",
1009-
tmp_bson ("{'isMaster': 1}"),
1010-
reply,
1011-
&error)) {
999+
if (!mongoc_client_command_simple (
1000+
client, "admin", tmp_bson ("{'isMaster': 1}"), NULL, reply, &error)) {
10121001
fprintf (stderr, "error calling ismaster: '%s'\n", error.message);
10131002
fprintf (stderr, "URI = %s\n", uri_str);
10141003
abort ();
10151004
}
1016-
mongoc_server_stream_cleanup (server_stream);
10171005

10181006
mongoc_client_destroy (client);
10191007
mongoc_uri_destroy (uri);

0 commit comments

Comments
 (0)