Skip to content

Commit ed77cb8

Browse files
committed
CDRIVER-497 remove obsolete param in test helper functions
1 parent 6955abe commit ed77cb8

11 files changed

+97
-99
lines changed

tests/test-bulk.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ test_bulk (void)
333333
bson_t doc = BSON_INITIALIZER;
334334
bool r;
335335

336-
client = test_framework_client_new (NULL);
336+
client = test_framework_client_new ();
337337
assert (client);
338338
has_write_cmds = server_has_write_commands (client);
339339

@@ -397,7 +397,7 @@ test_insert (bool ordered)
397397
mongoc_cursor_t *cursor;
398398
const bson_t *inserted_doc;
399399

400-
client = test_framework_client_new (NULL);
400+
client = test_framework_client_new ();
401401
assert (client);
402402
has_write_cmds = server_has_write_commands (client);
403403

@@ -471,7 +471,7 @@ test_insert_check_keys (void)
471471
bool r;
472472
char *json_pattern;
473473

474-
client = test_framework_client_new (NULL);
474+
client = test_framework_client_new ();
475475
assert (client);
476476
has_write_cmds = server_has_write_commands (client);
477477

@@ -522,7 +522,7 @@ test_upsert (bool ordered)
522522
bson_t *doc;
523523
bool r;
524524

525-
client = test_framework_client_new (NULL);
525+
client = test_framework_client_new ();
526526
assert (client);
527527
has_write_cmds = server_has_write_commands (client);
528528

@@ -612,7 +612,7 @@ test_upserted_index (bool ordered)
612612
bson_t *inc = tmp_bson ("{'$inc': {'b': 1}}");
613613
bool r;
614614

615-
client = test_framework_client_new (NULL);
615+
client = test_framework_client_new ();
616616
assert (client);
617617
has_write_cmds = server_has_write_commands (client);
618618

@@ -766,7 +766,7 @@ test_update_one (bool ordered)
766766
bson_t *doc;
767767
bool r;
768768

769-
client = test_framework_client_new (NULL);
769+
client = test_framework_client_new ();
770770
assert (client);
771771
has_write_cmds = server_has_write_commands (client);
772772

@@ -839,7 +839,7 @@ test_replace_one (bool ordered)
839839
bson_t *doc;
840840
bool r;
841841

842-
client = test_framework_client_new (NULL);
842+
client = test_framework_client_new ();
843843
assert (client);
844844
has_write_cmds = server_has_write_commands (client);
845845

@@ -898,7 +898,7 @@ test_upsert_large ()
898898
bson_t reply;
899899
bool r;
900900

901-
client = test_framework_client_new (NULL);
901+
client = test_framework_client_new ();
902902
assert (client);
903903
has_write_cmds = server_has_write_commands (client);
904904

@@ -970,7 +970,7 @@ test_update (bool ordered)
970970
bson_t *update_doc;
971971
bool r;
972972

973-
client = test_framework_client_new (NULL);
973+
client = test_framework_client_new ();
974974
assert (client);
975975
has_write_cmds = server_has_write_commands (client);
976976

@@ -1044,7 +1044,7 @@ test_index_offset (void)
10441044
bson_t *doc;
10451045
bool r;
10461046

1047-
client = test_framework_client_new (NULL);
1047+
client = test_framework_client_new ();
10481048
assert (client);
10491049
has_write_cmds = server_has_write_commands (client);
10501050

@@ -1101,7 +1101,7 @@ test_single_ordered_bulk ()
11011101
bson_error_t error;
11021102
bool r;
11031103

1104-
client = test_framework_client_new (NULL);
1104+
client = test_framework_client_new ();
11051105
assert (client);
11061106
has_write_cmds = server_has_write_commands (client);
11071107

@@ -1156,7 +1156,7 @@ test_insert_continue_on_error ()
11561156
bson_error_t error;
11571157
bool r;
11581158

1159-
client = test_framework_client_new (NULL);
1159+
client = test_framework_client_new ();
11601160
assert (client);
11611161
has_write_cmds = server_has_write_commands (client);
11621162

@@ -1203,7 +1203,7 @@ test_update_continue_on_error ()
12031203
bson_error_t error;
12041204
bool r;
12051205

1206-
client = test_framework_client_new (NULL);
1206+
client = test_framework_client_new ();
12071207
assert (client);
12081208
has_write_cmds = server_has_write_commands (client);
12091209

@@ -1267,7 +1267,7 @@ test_remove_continue_on_error ()
12671267
bson_error_t error;
12681268
bool r;
12691269

1270-
client = test_framework_client_new (NULL);
1270+
client = test_framework_client_new ();
12711271
assert (client);
12721272
has_write_cmds = server_has_write_commands (client);
12731273

@@ -1317,7 +1317,7 @@ test_single_error_ordered_bulk ()
13171317
bson_error_t error;
13181318
bool r;
13191319

1320-
client = test_framework_client_new (NULL);
1320+
client = test_framework_client_new ();
13211321
assert (client);
13221322
has_write_cmds = server_has_write_commands (client);
13231323

@@ -1375,7 +1375,7 @@ test_multiple_error_ordered_bulk ()
13751375
bson_error_t error;
13761376
bool r;
13771377

1378-
client = test_framework_client_new (NULL);
1378+
client = test_framework_client_new ();
13791379
assert (client);
13801380
has_write_cmds = server_has_write_commands (client);
13811381

@@ -1442,7 +1442,7 @@ test_single_unordered_bulk ()
14421442
bson_error_t error;
14431443
bool r;
14441444

1445-
client = test_framework_client_new (NULL);
1445+
client = test_framework_client_new ();
14461446
assert (client);
14471447
has_write_cmds = server_has_write_commands (client);
14481448

@@ -1493,7 +1493,7 @@ test_single_error_unordered_bulk ()
14931493
bson_error_t error;
14941494
bool r;
14951495

1496-
client = test_framework_client_new (NULL);
1496+
client = test_framework_client_new ();
14971497
assert (client);
14981498
has_write_cmds = server_has_write_commands (client);
14991499

@@ -1664,7 +1664,7 @@ test_multiple_error_unordered_bulk ()
16641664
bson_error_t error;
16651665
bool r;
16661666

1667-
client = test_framework_client_new (NULL);
1667+
client = test_framework_client_new ();
16681668
assert (client);
16691669
has_write_cmds = server_has_write_commands (client);
16701670

@@ -1742,7 +1742,7 @@ test_large_inserts_ordered ()
17421742
bson_iter_t iter;
17431743
int i;
17441744

1745-
client = test_framework_client_new (NULL);
1745+
client = test_framework_client_new ();
17461746
assert (client);
17471747
has_write_cmds = server_has_write_commands (client);
17481748

@@ -1820,7 +1820,7 @@ test_large_inserts_unordered ()
18201820
bson_iter_t iter;
18211821
int i;
18221822

1823-
client = test_framework_client_new (NULL);
1823+
client = test_framework_client_new ();
18241824
assert (client);
18251825

18261826
huge_doc = BCON_NEW ("a", BCON_INT32 (1));
@@ -1901,7 +1901,7 @@ _test_numerous (bool ordered)
19011901
bson_iter_t iter;
19021902
int i;
19031903

1904-
client = test_framework_client_new (NULL);
1904+
client = test_framework_client_new ();
19051905
assert (client);
19061906

19071907
collection = get_test_collection (client, "test_numerous_inserts");
@@ -1990,7 +1990,7 @@ test_bulk_edge_over_1000 (void)
19901990
bson_error_t error;
19911991
int i;
19921992

1993-
client = test_framework_client_new (NULL);
1993+
client = test_framework_client_new ();
19941994
assert (client);
19951995

19961996
collection = get_test_collection (client, "OVER_1000");
@@ -2063,7 +2063,7 @@ test_bulk_edge_case_372 (bool ordered)
20632063
bson_t reply;
20642064
bool r;
20652065

2066-
client = test_framework_client_new (NULL);
2066+
client = test_framework_client_new ();
20672067
assert (client);
20682068
has_write_cmds = server_has_write_commands (client);
20692069

@@ -2152,7 +2152,7 @@ test_bulk_new (void)
21522152
bson_t empty = BSON_INITIALIZER;
21532153
bool r;
21542154

2155-
client = test_framework_client_new (NULL);
2155+
client = test_framework_client_new ();
21562156
assert (client);
21572157

21582158
collection = get_test_collection (client, "bulk_new");

tests/test-libmongoc.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ test_framework_get_uri_str_no_auth (const char *database_name)
661661
*--------------------------------------------------------------------------
662662
*/
663663
char *
664-
test_framework_get_uri_str (const char *uri_str) /* TODO: remove parameter */
664+
test_framework_get_uri_str ()
665665
{
666666
return test_framework_add_user_password_from_env (
667667
test_framework_get_uri_str_no_auth (NULL));
@@ -685,9 +685,9 @@ test_framework_get_uri_str (const char *uri_str) /* TODO: remove parameter */
685685
*--------------------------------------------------------------------------
686686
*/
687687
mongoc_uri_t *
688-
test_framework_get_uri (const char *uri_str) /* TODO: remove parameter */
688+
test_framework_get_uri ()
689689
{
690-
char *test_uri_str = test_framework_get_uri_str (NULL);
690+
char *test_uri_str = test_framework_get_uri_str ();
691691
mongoc_uri_t *uri = mongoc_uri_new (test_uri_str);
692692

693693
assert (uri);
@@ -746,9 +746,9 @@ test_framework_set_ssl_opts (mongoc_client_t *client)
746746
*--------------------------------------------------------------------------
747747
*/
748748
mongoc_client_t *
749-
test_framework_client_new (const char *uri_str)
749+
test_framework_client_new ()
750750
{
751-
char *test_uri_str = test_framework_get_uri_str (uri_str);
751+
char *test_uri_str = test_framework_get_uri_str ();
752752
mongoc_client_t *client = mongoc_client_new (test_uri_str);
753753

754754
assert (client);
@@ -810,17 +810,15 @@ test_framework_set_pool_ssl_opts (mongoc_client_pool_t *pool)
810810
*--------------------------------------------------------------------------
811811
*/
812812
mongoc_client_pool_t *
813-
test_framework_client_pool_new (const char *uri_str)
813+
test_framework_client_pool_new ()
814814
{
815-
char *test_uri_str = test_framework_get_uri_str (uri_str);
816-
mongoc_uri_t *test_uri = mongoc_uri_new (test_uri_str);
815+
mongoc_uri_t *test_uri = test_framework_get_uri ();
817816
mongoc_client_pool_t *pool = mongoc_client_pool_new (test_uri);
818817

819818
assert (pool);
820819
test_framework_set_pool_ssl_opts (pool);
821820

822821
mongoc_uri_destroy (test_uri);
823-
bson_free (test_uri_str);
824822
assert (pool);
825823
return pool;
826824
}

tests/test-libmongoc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ char *test_framework_add_user_password (const char *uri_str,
3131
const char *user,
3232
const char *password);
3333
char *test_framework_get_uri_str_no_auth (const char *database_name);
34-
char *test_framework_get_uri_str (const char *uri_str);
35-
mongoc_uri_t *test_framework_get_uri (const char *uri_str);
36-
mongoc_client_t *test_framework_client_new (const char *uri_str);
37-
mongoc_client_pool_t *test_framework_client_pool_new (const char *uri_str);
34+
char *test_framework_get_uri_str (void);
35+
mongoc_uri_t *test_framework_get_uri (void);
36+
mongoc_client_t *test_framework_client_new (void);
37+
mongoc_client_pool_t *test_framework_client_pool_new (void);
3838
#endif

tests/test-mongoc-client.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ test_mongoc_client_authenticate (void *context)
7777
/*
7878
* Log in as admin.
7979
*/
80-
admin_client = test_framework_client_new (NULL);
80+
admin_client = test_framework_client_new ();
8181

8282
/*
8383
* Add a user to the test database.
@@ -139,7 +139,7 @@ int should_run_auth_tests (void)
139139
{
140140
char *user;
141141
#ifndef MONGOC_ENABLE_SSL
142-
mongoc_client_t *client = test_framework_client_new (NULL);
142+
mongoc_client_t *client = test_framework_client_new ();
143143
uint32_t server_id = mongoc_cluster_preselect(&client->cluster, MONGOC_OPCODE_QUERY, NULL, NULL);
144144

145145
if (mongoc_cluster_node_max_wire_version (&client->cluster, server_id) > 2) {
@@ -356,7 +356,7 @@ test_mongoc_client_command (void)
356356
bool r;
357357
bson_t cmd = BSON_INITIALIZER;
358358

359-
client = test_framework_client_new (NULL);
359+
client = test_framework_client_new ();
360360
assert (client);
361361

362362
bson_append_int32 (&cmd, "ping", 4, 1);
@@ -386,7 +386,7 @@ test_mongoc_client_command_secondary (void)
386386
mongoc_read_prefs_t *read_prefs;
387387
bson_t cmd = BSON_INITIALIZER;
388388

389-
client = test_framework_client_new (NULL);
389+
client = test_framework_client_new ();
390390
assert (client);
391391

392392
BSON_APPEND_INT32 (&cmd, "invalid_command_here", 1);
@@ -413,7 +413,7 @@ test_mongoc_client_preselect (void)
413413
bson_error_t error;
414414
uint32_t node;
415415

416-
client = test_framework_client_new (NULL);
416+
client = test_framework_client_new ();
417417
assert (client);
418418

419419
node = _mongoc_client_preselect (client, MONGOC_OPCODE_INSERT,
@@ -670,7 +670,7 @@ test_exhaust_cursor (void)
670670
bson_error_t error;
671671
bson_oid_t oid;
672672

673-
client = test_framework_client_new (NULL);
673+
client = test_framework_client_new ();
674674
assert (client);
675675

676676
collection = get_test_collection (client, "test_exhaust_cursor");
@@ -836,7 +836,7 @@ test_server_status (void)
836836
bson_t reply;
837837
bool r;
838838

839-
client = test_framework_client_new (NULL);
839+
client = test_framework_client_new ();
840840
assert (client);
841841

842842
r = mongoc_client_get_server_status (client, NULL, &reply, &error);

tests/test-mongoc-cluster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test_get_max_bson_obj_size (void)
2222
uint32_t id;
2323

2424
/* single-threaded */
25-
client = test_framework_client_new (NULL);
25+
client = test_framework_client_new ();
2626
assert (client);
2727

2828
id = mongoc_cluster_preselect (&client->cluster, MONGOC_OPCODE_QUERY, NULL, &error);
@@ -33,7 +33,7 @@ test_get_max_bson_obj_size (void)
3333
mongoc_client_destroy (client);
3434

3535
/* multi-threaded */
36-
pool = test_framework_client_pool_new (NULL);
36+
pool = test_framework_client_pool_new ();
3737
client = mongoc_client_pool_pop (pool);
3838

3939
id = mongoc_cluster_preselect (&client->cluster, MONGOC_OPCODE_QUERY, NULL, &error);
@@ -62,7 +62,7 @@ test_get_max_msg_size (void)
6262
uint32_t id;
6363

6464
/* single-threaded */
65-
client = test_framework_client_new (NULL);
65+
client = test_framework_client_new ();
6666

6767
id = mongoc_cluster_preselect (&client->cluster, MONGOC_OPCODE_QUERY, NULL, &error);
6868
sd = mongoc_set_get (client->topology->description.servers, id);
@@ -72,7 +72,7 @@ test_get_max_msg_size (void)
7272
mongoc_client_destroy (client);
7373

7474
/* multi-threaded */
75-
pool = test_framework_client_pool_new (NULL);
75+
pool = test_framework_client_pool_new ();
7676
client = mongoc_client_pool_pop (pool);
7777

7878
id = mongoc_cluster_preselect (&client->cluster, MONGOC_OPCODE_QUERY, NULL, &error);

0 commit comments

Comments
 (0)