Skip to content

CDRIVER-4353 unskip /server_discovery_and_monitoring/monitoring/heartbeat/pooled/dns #1440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 12, 2023
1 change: 0 additions & 1 deletion .evergreen/etc/skip-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@
/transactions/legacy/mongos-recovery-token/"commitTransaction retry fails on new mongos" # fails with server selection timeout (CDRIVER-4268)
/transactions/legacy/pin-mongos/"unpin after transient error within a transaction and commit" # (CDRIVER-4351) server selection timeout (on ASAN Tests Ubuntu 18.04 build variant)
/Samples # (CDRIVER-4352) strange "heartbeat failed" error
/server_discovery_and_monitoring/monitoring/heartbeat/pooled/dns # (CDRIVER-4353) this initially seemed like a zSeries w/ RHEL8 issue, but it also appeared on arm64 w/ Ubuntu 18.04

/client_side_encryption/bypass_spawning_mongocryptd/mongocryptdBypassSpawn # Fails if crypt_shared is visible
25 changes: 0 additions & 25 deletions src/libmongoc/tests/test-libmongoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,31 +1998,6 @@ test_framework_skip_if_offline (void)
}


int
test_framework_skip_if_rhel8_zseries (void)
{
/* CDRIVER-3923: It appears that when running on RHEL8 on zSeries the
* /server_discovery_and_monitoring/monitoring/heartbeat/pooled/dns test
* fails. The best guess is that calling getaddrinfo() on that platform
* blocks for 5 seconds, while the test expects a server selection error
* after 3000 ms, or 3 seconds. Skip the test when executing on RHEL8 on
* zSeries. */
#ifdef __s390x__
char *name;
char *version;
_mongoc_linux_distro_scanner_get_distro (&name, &version);
bool rhel = strcmp (name, "Red Hat Enterprise Linux") == 0;
bool vers8 = version[0] == '8';
int skip = (rhel && vers8) ? 0 : 1;
bson_free (name);
bson_free (version);
return skip;
#else
return 1;
#endif
}


int
test_framework_skip_if_slow (void)
{
Expand Down
2 changes: 0 additions & 2 deletions src/libmongoc/tests/test-libmongoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ test_framework_skip_if_not_single (void);
int
test_framework_skip_if_offline (void);
int
test_framework_skip_if_rhel8_zseries (void);
int
test_framework_skip_if_slow (void);
int
test_framework_skip_if_slow_or_live (void);
Expand Down
33 changes: 11 additions & 22 deletions src/libmongoc/tests/test-mongoc-sdam-monitoring.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ _test_heartbeat_fails_dns (bool pooled)
* client for a client pool). */
start = bson_get_monotonic_time ();
uri = mongoc_uri_new (
"mongodb://doesntexist.foobar/?serverSelectionTimeoutMS=3000");
"mongodb://doesntexist.invalid/?serverSelectionTimeoutMS=100");
if (pooled) {
pool = test_framework_client_pool_new_from_uri (uri, NULL);
pool_set_heartbeat_event_callbacks (pool, &context);
Expand All @@ -862,15 +862,13 @@ _test_heartbeat_fails_dns (bool pooled)
r = mongoc_client_command_simple (
client, "admin", tmp_bson ("{'foo': 1}"), NULL, NULL, &error);

/* This should result in either a DNS failure or connection failure depending
* on the network. We assert the domain/code but not the message string. */
/* Expect a server selection error. */
ASSERT (!r);
ASSERT_ERROR_CONTAINS (error,
MONGOC_ERROR_SERVER_SELECTION,
MONGOC_ERROR_SERVER_SELECTION_FAILURE,
"");
"No suitable servers found");

duration = bson_get_monotonic_time () - start;

if (pooled) {
mongoc_client_pool_push (pool, client);
Expand All @@ -879,6 +877,8 @@ _test_heartbeat_fails_dns (bool pooled)
mongoc_client_destroy (client);
}

duration = bson_get_monotonic_time () - start;

durations = &context.heartbeat_failed_durations;

ASSERT_CMPSIZE_T (durations->len, >, (size_t) 0);
Expand All @@ -893,18 +893,14 @@ _test_heartbeat_fails_dns (bool pooled)
}

static void
test_heartbeat_fails_dns_single (void *ctx)
test_heartbeat_fails_dns_single (void)
{
BSON_UNUSED (ctx);

_test_heartbeat_fails_dns (false);
}

static void
test_heartbeat_fails_dns_pooled (void *ctx)
test_heartbeat_fails_dns_pooled (void)
{
BSON_UNUSED (ctx);

_test_heartbeat_fails_dns (true);
}

Expand Down Expand Up @@ -1054,21 +1050,14 @@ test_sdam_monitoring_install (TestSuite *suite)
suite,
"/server_discovery_and_monitoring/monitoring/heartbeat/pooled/failed",
test_heartbeat_events_pooled_failed);
TestSuite_AddFull (
TestSuite_Add (
suite,
"/server_discovery_and_monitoring/monitoring/heartbeat/single/dns",
test_heartbeat_fails_dns_single,
NULL,
NULL,
test_framework_skip_if_offline);
TestSuite_AddFull (
test_heartbeat_fails_dns_single);
TestSuite_Add (
suite,
"/server_discovery_and_monitoring/monitoring/heartbeat/pooled/dns",
test_heartbeat_fails_dns_pooled,
NULL,
NULL,
test_framework_skip_if_offline,
test_framework_skip_if_rhel8_zseries);
test_heartbeat_fails_dns_pooled);
TestSuite_AddMockServerTest (
suite,
"/server_discovery_and_monitoring/monitoring/no_duplicates",
Expand Down