27
27
#include "mock_server/mock-server.h"
28
28
29
29
/*
30
- * Call this before any test which uses mongoc_metadata_append , to
30
+ * Call this before any test which uses mongoc_handshake_data_append , to
31
31
* reset the global state and unfreeze the metadata struct. Call it
32
32
* after a test so later tests don't have a weird metadata document
33
33
*
@@ -108,7 +108,7 @@ test_mongoc_metadata_appname_frozen_pooled (void)
108
108
}
109
109
110
110
static void
111
- test_mongoc_metadata_append_success (void )
111
+ test_mongoc_handshake_data_append_success (void )
112
112
{
113
113
mock_server_t * server ;
114
114
mongoc_uri_t * uri ;
@@ -132,7 +132,7 @@ test_mongoc_metadata_append_success (void)
132
132
133
133
_reset_metadata ();
134
134
/* Make sure setting the metadata works */
135
- ASSERT (mongoc_metadata_append (driver_name , driver_version , platform ));
135
+ ASSERT (mongoc_handshake_data_append (driver_name , driver_version , platform ));
136
136
137
137
server = mock_server_new ();
138
138
mock_server_run (server );
@@ -212,7 +212,7 @@ test_mongoc_metadata_append_success (void)
212
212
}
213
213
214
214
static void
215
- test_mongoc_metadata_append_after_cmd (void )
215
+ test_mongoc_handshake_data_append_after_cmd (void )
216
216
{
217
217
mongoc_client_pool_t * pool ;
218
218
mongoc_client_t * client ;
@@ -228,7 +228,12 @@ test_mongoc_metadata_append_after_cmd (void)
228
228
229
229
client = mongoc_client_pool_pop (pool );
230
230
231
- ASSERT (!mongoc_metadata_append ("a" , "a" , "a" ));
231
+ capture_logs (true);
232
+ ASSERT (!mongoc_handshake_data_append ("a" , "a" , "a" ));
233
+ ASSERT_CAPTURED_LOG ("mongoc_handshake_data_append" ,
234
+ MONGOC_LOG_LEVEL_ERROR ,
235
+ "Cannot set metadata more than once" );
236
+ capture_logs (false);
232
237
233
238
mongoc_client_pool_push (pool , client );
234
239
@@ -265,7 +270,7 @@ test_mongoc_metadata_too_big (void)
265
270
266
271
memset (big_string , 'a' , BUFFER_SIZE - 1 );
267
272
big_string [BUFFER_SIZE - 1 ] = '\0' ;
268
- ASSERT (mongoc_metadata_append (NULL , NULL , big_string ));
273
+ ASSERT (mongoc_handshake_data_append (NULL , NULL , big_string ));
269
274
270
275
uri = mongoc_uri_copy (mock_server_get_uri (server ));
271
276
client = mongoc_client_new_from_uri (uri );
@@ -405,9 +410,9 @@ test_metadata_install (TestSuite *suite)
405
410
test_mongoc_metadata_appname_frozen_pooled );
406
411
407
412
TestSuite_Add (suite , "/ClientMetadata/success" ,
408
- test_mongoc_metadata_append_success );
413
+ test_mongoc_handshake_data_append_success );
409
414
TestSuite_Add (suite , "/ClientMetadata/failure" ,
410
- test_mongoc_metadata_append_after_cmd );
415
+ test_mongoc_handshake_data_append_after_cmd );
411
416
TestSuite_Add (suite , "/ClientMetadata/too_big" ,
412
417
test_mongoc_metadata_too_big );
413
418
TestSuite_Add (suite , "/ClientMetadata/cannot_send" ,
0 commit comments