Skip to content

Commit a035ec3

Browse files
committed
CDRIVER-3419 set TLS opts in new clients
1 parent b4b1d75 commit a035ec3

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/libmongoc/tests/json-test-operations.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,8 @@ create_collection (mongoc_database_t *db,
18041804
collection_name = bson_lookup_utf8 (&args, "collection");
18051805
COPY_EXCEPT ("collection");
18061806

1807-
collection = mongoc_database_create_collection (db, collection_name, &opts, &error);
1807+
collection =
1808+
mongoc_database_create_collection (db, collection_name, &opts, &error);
18081809

18091810
bson_destroy (&opts);
18101811

@@ -1912,13 +1913,13 @@ static bool
19121913
collection_exists (mongoc_client_t *client, const bson_t *operation)
19131914
{
19141915
char **names;
1915-
char **name;
19161916
bson_t args;
19171917
const char *database_name;
19181918
const char *collection_name;
19191919
bson_error_t error;
19201920
mongoc_database_t *db;
19211921
bool found = false;
1922+
uint32_t i;
19221923

19231924
bson_lookup_doc (operation, "arguments", &args);
19241925
database_name = bson_lookup_utf8 (&args, "database");
@@ -1927,17 +1928,20 @@ collection_exists (mongoc_client_t *client, const bson_t *operation)
19271928
db = mongoc_client_get_database (client, database_name);
19281929

19291930
names = mongoc_database_get_collection_names_with_opts (db, NULL, &error);
1931+
if (!names) {
1932+
test_error ("expected error checking if collection '%s' exists: %s",
1933+
collection_name,
1934+
error.message);
1935+
}
19301936

1931-
for (name = names; *name; name++) {
1932-
if (!strcmp (*name, collection_name)) {
1937+
for (i = 0; names && names[i] != NULL; i++) {
1938+
if (!strcmp (names[i], collection_name)) {
19331939
found = true;
19341940
}
1935-
1936-
bson_free (*name);
19371941
}
19381942

1939-
bson_free (names);
19401943
mongoc_database_destroy (db);
1944+
bson_strfreev (names);
19411945

19421946
return found;
19431947
}
@@ -2156,6 +2160,7 @@ json_test_operation (json_test_ctx_t *ctx,
21562160
mongoc_client_t *client;
21572161

21582162
client = mongoc_client_new_from_uri (ctx->client->uri);
2163+
test_framework_set_ssl_opts (client);
21592164
activate_fail_point (
21602165
client, session->server_id, operation, "arguments.failPoint");
21612166

@@ -2181,6 +2186,7 @@ json_test_operation (json_test_ctx_t *ctx,
21812186
bool exists;
21822187

21832188
client = mongoc_client_new_from_uri (ctx->client->uri);
2189+
test_framework_set_ssl_opts (client);
21842190
exists = collection_exists (client, operation);
21852191
mongoc_client_destroy (client);
21862192

@@ -2190,6 +2196,7 @@ json_test_operation (json_test_ctx_t *ctx,
21902196
bool exists;
21912197

21922198
client = mongoc_client_new_from_uri (ctx->client->uri);
2199+
test_framework_set_ssl_opts (client);
21932200
exists = collection_exists (client, operation);
21942201
mongoc_client_destroy (client);
21952202

@@ -2199,6 +2206,7 @@ json_test_operation (json_test_ctx_t *ctx,
21992206
bool exists;
22002207

22012208
client = mongoc_client_new_from_uri (ctx->client->uri);
2209+
test_framework_set_ssl_opts (client);
22022210
exists = index_exists (client, operation);
22032211
mongoc_client_destroy (client);
22042212

@@ -2208,6 +2216,7 @@ json_test_operation (json_test_ctx_t *ctx,
22082216
bool exists;
22092217

22102218
client = mongoc_client_new_from_uri (ctx->client->uri);
2219+
test_framework_set_ssl_opts (client);
22112220
exists = index_exists (client, operation);
22122221
mongoc_client_destroy (client);
22132222

0 commit comments

Comments
 (0)