2727#include "mock_server/mock-server.h"
2828
2929/*
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
3131 * reset the global state and unfreeze the metadata struct. Call it
3232 * after a test so later tests don't have a weird metadata document
3333 *
@@ -108,7 +108,7 @@ test_mongoc_metadata_appname_frozen_pooled (void)
108108}
109109
110110static void
111- test_mongoc_metadata_append_success (void )
111+ test_mongoc_handshake_data_append_success (void )
112112{
113113 mock_server_t * server ;
114114 mongoc_uri_t * uri ;
@@ -132,7 +132,7 @@ test_mongoc_metadata_append_success (void)
132132
133133 _reset_metadata ();
134134 /* 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 ));
136136
137137 server = mock_server_new ();
138138 mock_server_run (server );
@@ -212,7 +212,7 @@ test_mongoc_metadata_append_success (void)
212212}
213213
214214static void
215- test_mongoc_metadata_append_after_cmd (void )
215+ test_mongoc_handshake_data_append_after_cmd (void )
216216{
217217 mongoc_client_pool_t * pool ;
218218 mongoc_client_t * client ;
@@ -228,7 +228,12 @@ test_mongoc_metadata_append_after_cmd (void)
228228
229229 client = mongoc_client_pool_pop (pool );
230230
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);
232237
233238 mongoc_client_pool_push (pool , client );
234239
@@ -265,7 +270,7 @@ test_mongoc_metadata_too_big (void)
265270
266271 memset (big_string , 'a' , BUFFER_SIZE - 1 );
267272 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 ));
269274
270275 uri = mongoc_uri_copy (mock_server_get_uri (server ));
271276 client = mongoc_client_new_from_uri (uri );
@@ -405,9 +410,9 @@ test_metadata_install (TestSuite *suite)
405410 test_mongoc_metadata_appname_frozen_pooled );
406411
407412 TestSuite_Add (suite , "/ClientMetadata/success" ,
408- test_mongoc_metadata_append_success );
413+ test_mongoc_handshake_data_append_success );
409414 TestSuite_Add (suite , "/ClientMetadata/failure" ,
410- test_mongoc_metadata_append_after_cmd );
415+ test_mongoc_handshake_data_append_after_cmd );
411416 TestSuite_Add (suite , "/ClientMetadata/too_big" ,
412417 test_mongoc_metadata_too_big );
413418 TestSuite_Add (suite , "/ClientMetadata/cannot_send" ,
0 commit comments