[glib/backport-865-happier-eyeballs-glib-2-60] network-address test: add ipv6-fail ipv4-slow case
- From: Allison Karlitskaya <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/backport-865-happier-eyeballs-glib-2-60] network-address test: add ipv6-fail ipv4-slow case
- Date: Wed, 5 Jun 2019 07:35:33 +0000 (UTC)
commit 24c2760c8f8c2923d74e5941bb56ffa1085ee49f
Author: Allison Karlitskaya <allison karlitskaya redhat com>
Date: Tue May 28 17:04:51 2019 +0200
network-address test: add ipv6-fail ipv4-slow case
Add a case for when the IPv6 result comes back negative and the IPv4
result is significantly delayed. This is exactly the case that causes
the bug addressed by GNOME/glib!865
gio/tests/network-address.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/gio/tests/network-address.c b/gio/tests/network-address.c
index 0dcd7b292..395734b1b 100644
--- a/gio/tests/network-address.c
+++ b/gio/tests/network-address.c
@@ -819,6 +819,30 @@ test_happy_eyeballs_ipv6_error_ipv6_first (HappyEyeballsFixture *fixture,
g_error_free (ipv6_error);
}
+static void
+test_happy_eyeballs_ipv6_error_ipv4_very_slow (HappyEyeballsFixture *fixture,
+ gconstpointer user_data)
+{
+ AsyncData data = { 0 };
+ GError *ipv6_error;
+
+ g_test_bug ("merge_requests/865");
+
+ /* If ipv6 fails, ensuring that ipv6 errors before ipv4 finishes, we still get ipv4. */
+
+ data.loop = fixture->loop;
+ ipv6_error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_TIMED_OUT, "IPv6 Broken");
+ mock_resolver_set_ipv6_error (fixture->mock_resolver, ipv6_error);
+ mock_resolver_set_ipv4_delay_ms (fixture->mock_resolver, SLOW_DELAY_MORE_THAN_TIMEOUT);
+
+ g_socket_address_enumerator_next_async (fixture->enumerator, NULL, got_addr, &data);
+ g_main_loop_run (fixture->loop);
+
+ assert_list_matches_expected (data.addrs, fixture->input_ipv4_results);
+
+ g_error_free (ipv6_error);
+}
+
static void
test_happy_eyeballs_ipv4_error_ipv4_first (HappyEyeballsFixture *fixture,
gconstpointer user_data)
@@ -977,6 +1001,7 @@ main (int argc, char *argv[])
gchar *path;
g_test_init (&argc, &argv, NULL);
+ g_test_bug_base ("https://gitlab.gnome.org/GNOME/glib/");
g_test_add_func ("/network-address/basic", test_basic);
@@ -1031,6 +1056,8 @@ main (int argc, char *argv[])
happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv4_first, happy_eyeballs_teardown);
g_test_add ("/network-address/happy-eyeballs/ipv6-error-ipv6-first", HappyEyeballsFixture, NULL,
happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv6_first, happy_eyeballs_teardown);
+ g_test_add ("/network-address/happy-eyeballs/ipv6-error-ipv4-very-slow", HappyEyeballsFixture, NULL,
+ happy_eyeballs_setup, test_happy_eyeballs_ipv6_error_ipv4_very_slow, happy_eyeballs_teardown);
g_test_add ("/network-address/happy-eyeballs/ipv4-error-ipv6-first", HappyEyeballsFixture, NULL,
happy_eyeballs_setup, test_happy_eyeballs_ipv4_error_ipv6_first, happy_eyeballs_teardown);
g_test_add ("/network-address/happy-eyeballs/ipv4-error-ipv4-first", HappyEyeballsFixture, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]