@@ -1804,7 +1804,8 @@ create_collection (mongoc_database_t *db,
1804
1804
collection_name = bson_lookup_utf8 (& args , "collection" );
1805
1805
COPY_EXCEPT ("collection" );
1806
1806
1807
- collection = mongoc_database_create_collection (db , collection_name , & opts , & error );
1807
+ collection =
1808
+ mongoc_database_create_collection (db , collection_name , & opts , & error );
1808
1809
1809
1810
bson_destroy (& opts );
1810
1811
@@ -1912,13 +1913,13 @@ static bool
1912
1913
collection_exists (mongoc_client_t * client , const bson_t * operation )
1913
1914
{
1914
1915
char * * names ;
1915
- char * * name ;
1916
1916
bson_t args ;
1917
1917
const char * database_name ;
1918
1918
const char * collection_name ;
1919
1919
bson_error_t error ;
1920
1920
mongoc_database_t * db ;
1921
1921
bool found = false;
1922
+ uint32_t i ;
1922
1923
1923
1924
bson_lookup_doc (operation , "arguments" , & args );
1924
1925
database_name = bson_lookup_utf8 (& args , "database" );
@@ -1927,17 +1928,20 @@ collection_exists (mongoc_client_t *client, const bson_t *operation)
1927
1928
db = mongoc_client_get_database (client , database_name );
1928
1929
1929
1930
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
+ }
1930
1936
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 )) {
1933
1939
found = true;
1934
1940
}
1935
-
1936
- bson_free (* name );
1937
1941
}
1938
1942
1939
- bson_free (names );
1940
1943
mongoc_database_destroy (db );
1944
+ bson_strfreev (names );
1941
1945
1942
1946
return found ;
1943
1947
}
@@ -2156,6 +2160,7 @@ json_test_operation (json_test_ctx_t *ctx,
2156
2160
mongoc_client_t * client ;
2157
2161
2158
2162
client = mongoc_client_new_from_uri (ctx -> client -> uri );
2163
+ test_framework_set_ssl_opts (client );
2159
2164
activate_fail_point (
2160
2165
client , session -> server_id , operation , "arguments.failPoint" );
2161
2166
@@ -2181,6 +2186,7 @@ json_test_operation (json_test_ctx_t *ctx,
2181
2186
bool exists ;
2182
2187
2183
2188
client = mongoc_client_new_from_uri (ctx -> client -> uri );
2189
+ test_framework_set_ssl_opts (client );
2184
2190
exists = collection_exists (client , operation );
2185
2191
mongoc_client_destroy (client );
2186
2192
@@ -2190,6 +2196,7 @@ json_test_operation (json_test_ctx_t *ctx,
2190
2196
bool exists ;
2191
2197
2192
2198
client = mongoc_client_new_from_uri (ctx -> client -> uri );
2199
+ test_framework_set_ssl_opts (client );
2193
2200
exists = collection_exists (client , operation );
2194
2201
mongoc_client_destroy (client );
2195
2202
@@ -2199,6 +2206,7 @@ json_test_operation (json_test_ctx_t *ctx,
2199
2206
bool exists ;
2200
2207
2201
2208
client = mongoc_client_new_from_uri (ctx -> client -> uri );
2209
+ test_framework_set_ssl_opts (client );
2202
2210
exists = index_exists (client , operation );
2203
2211
mongoc_client_destroy (client );
2204
2212
@@ -2208,6 +2216,7 @@ json_test_operation (json_test_ctx_t *ctx,
2208
2216
bool exists ;
2209
2217
2210
2218
client = mongoc_client_new_from_uri (ctx -> client -> uri );
2219
+ test_framework_set_ssl_opts (client );
2211
2220
exists = index_exists (client , operation );
2212
2221
mongoc_client_destroy (client );
2213
2222
0 commit comments