Skip to content

Commit e0d3c4f

Browse files
CDRIVER-4342 unskip /Topology/multiple_selection_errors (#1426)
* unskip `/Topology/multiple_selection_errors` * use `.invalid` domains in test Intended to get a reliable DNS error, rather than contacting `example.com` Co-authored-by: Ezra Chung <[email protected]>
1 parent eec9249 commit e0d3c4f

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed

.evergreen/etc/skip-tests.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
/mongohouse/runCommand # CDRIVER-4333
2929

3030
/Stepdown/not_primary_keep # (CDRIVER-4341) Assert Failure: 673 == 674
31-
/Topology/multiple_selection_errors # (CDRIVER-4342) [No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'doesntexist'] [Failed to resolve 'example.com']] does not contain [calling hello on 'example.com:2']
3231
/change_stream/live/track_resume_token # (CDRIVER-4344) Condition 'bson_compare (resume_token, &doc2_rt) == 0' failed
3332
/change_stream/resumable_error # (CDRIVER-4345) getMore: not found
3433
/BulkOperation/split # (CDRIVER-4346) Assert Failure: count of split_1512376901_50824 is 97759, not 100010

src/libmongoc/tests/test-mongoc-server-selection-errors.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ static void
9191
test_server_selection_error_dns_direct_single (void)
9292
{
9393
server_selection_error_dns (
94-
"mongodb://example-localhost:27017/",
94+
"mongodb://example-localhost.invalid:27017/",
9595
"No suitable servers found (`serverSelectionTryOnce` set): "
96-
"[Fake error for 'example-localhost']",
96+
"[Fake error for 'example-localhost.invalid']",
9797
false,
9898
false);
9999
}
@@ -104,9 +104,9 @@ test_server_selection_error_dns_direct_pooled (void *ctx)
104104
BSON_UNUSED (ctx);
105105

106106
server_selection_error_dns (
107-
"mongodb://example-localhost:27017/",
107+
"mongodb://example-localhost.invalid:27017/",
108108
"No suitable servers found: `serverSelectionTimeoutMS` expired: "
109-
"[Fake error for 'example-localhost']",
109+
"[Fake error for 'example-localhost.invalid']",
110110
false,
111111
true);
112112
}
@@ -115,10 +115,11 @@ static void
115115
test_server_selection_error_dns_multi_fail_single (void)
116116
{
117117
server_selection_error_dns (
118-
"mongodb://example-localhost:27017,other-example-localhost:27017/",
118+
"mongodb://"
119+
"example-localhost.invalid:27017,other-example-localhost.invalid:27017/",
119120
"No suitable servers found (`serverSelectionTryOnce` set):"
120-
" [Fake error for 'example-localhost']"
121-
" [Fake error for 'other-example-localhost']",
121+
" [Fake error for 'example-localhost.invalid']"
122+
" [Fake error for 'other-example-localhost.invalid']",
122123
false,
123124
false);
124125
}
@@ -129,10 +130,11 @@ test_server_selection_error_dns_multi_fail_pooled (void *ctx)
129130
BSON_UNUSED (ctx);
130131

131132
server_selection_error_dns (
132-
"mongodb://example-localhost:27017,other-example-localhost:27017/",
133+
"mongodb://"
134+
"example-localhost.invalid:27017,other-example-localhost.invalid:27017/",
133135
"No suitable servers found: `serverSelectionTimeoutMS` expired:"
134-
" [Fake error for 'example-localhost']"
135-
" [Fake error for 'other-example-localhost']",
136+
" [Fake error for 'example-localhost.invalid']"
137+
" [Fake error for 'other-example-localhost.invalid']",
136138
false,
137139
true);
138140
}
@@ -144,9 +146,9 @@ _test_server_selection_error_dns_multi_success (bool pooled)
144146
char *uri_str;
145147

146148
host = test_framework_get_host ();
147-
uri_str = bson_strdup_printf ("mongodb://example-localhost:27017,"
149+
uri_str = bson_strdup_printf ("mongodb://example-localhost.invalid:27017,"
148150
"%s:%d,"
149-
"other-example-localhost:27017/",
151+
"other-example-localhost.invalid:27017/",
150152
host,
151153
test_framework_get_port ());
152154

src/libmongoc/tests/test-mongoc-topology.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,16 +1069,14 @@ test_select_after_try_once (void)
10691069

10701070

10711071
static void
1072-
test_multiple_selection_errors (void *context)
1072+
test_multiple_selection_errors (void)
10731073
{
1074-
const char *uri = "mongodb://doesntexist,example.com:2/?replicaSet=rs"
1075-
"&connectTimeoutMS=100";
1074+
const char *const uri = "mongodb://doesntexist.invalid,example.invalid/"
1075+
"?replicaSet=rs&connectTimeoutMS=100";
10761076
mongoc_client_t *client;
10771077
bson_t reply;
10781078
bson_error_t error;
10791079

1080-
BSON_UNUSED (context);
1081-
10821080
client = test_framework_client_new (uri, NULL);
10831081
mongoc_client_command_simple (
10841082
client, "test", tmp_bson ("{'ping': 1}"), NULL, &reply, &error);
@@ -1088,13 +1086,13 @@ test_multiple_selection_errors (void *context)
10881086

10891087
/* Like:
10901088
* "No suitable servers found (`serverselectiontryonce` set):
1091-
* [Failed to resolve 'doesntexist']
1092-
* [connection error calling hello on 'example.com:2']"
1089+
* [Failed to resolve 'doesntexist.invalid']
1090+
* [Failed to resolve 'example.invalid']
10931091
*/
10941092
ASSERT_CONTAINS (error.message, "No suitable servers found");
10951093
/* either "connection error" or "connection timeout" calling hello */
1096-
ASSERT_CONTAINS (error.message, "calling hello on 'example.com:2'");
1097-
ASSERT_CONTAINS (error.message, "[Failed to resolve 'doesntexist']");
1094+
ASSERT_CONTAINS (error.message, "[Failed to resolve 'doesntexist.invalid']");
1095+
ASSERT_CONTAINS (error.message, "[Failed to resolve 'example.invalid']");
10981096

10991097
bson_destroy (&reply);
11001098
mongoc_client_destroy (client);
@@ -2832,12 +2830,9 @@ test_topology_install (TestSuite *suite)
28322830
NULL,
28332831
NULL,
28342832
test_framework_skip_if_slow);
2835-
TestSuite_AddFull (suite,
2836-
"/Topology/multiple_selection_errors",
2837-
test_multiple_selection_errors,
2838-
NULL,
2839-
NULL,
2840-
test_framework_skip_if_offline);
2833+
TestSuite_Add (suite,
2834+
"/Topology/multiple_selection_errors",
2835+
test_multiple_selection_errors);
28412836
TestSuite_AddMockServerTest (
28422837
suite, "/Topology/connect_timeout/succeed", test_select_after_timeout);
28432838
TestSuite_AddMockServerTest (

0 commit comments

Comments
 (0)