Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] test: fix getaddrinfo test on Ubuntu 16.04
@ 2020-12-12  3:51 Roman Khabibov
  2021-03-15 17:48 ` Alexander Turenko via Tarantool-patches
  0 siblings, 1 reply; 2+ messages in thread
From: Roman Khabibov @ 2020-12-12  3:51 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Roman Khabibov, alexander.turenko

From: Roman Khabibov <roman.habibov1@yandex.ru>

Just add another one error code and error message that can be
returned by getaddrinfo() tests.

Folow up #4138
---

Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-4138-getaddr-follow-up

 test/app/gh-4138-getaddrinfo-errors.result           | 4 +++-
 test/app/gh-4138-getaddrinfo-errors.test.lua         | 4 +++-
 test/box/net.box_getaddrinfo_errors_gh-4138.result   | 4 +++-
 test/box/net.box_getaddrinfo_errors_gh-4138.test.lua | 4 +++-
 test/unit/coio.cc                                    | 6 +++++-
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/test/app/gh-4138-getaddrinfo-errors.result b/test/app/gh-4138-getaddrinfo-errors.result
index d301e3776..62b0721df 100644
--- a/test/app/gh-4138-getaddrinfo-errors.result
+++ b/test/app/gh-4138-getaddrinfo-errors.result
@@ -28,7 +28,9 @@ function check_err(err)
 -- EAI_AGAIN
        err == 'getaddrinfo: Temporary failure in name resolution' or
 -- EAI_AGAIN
-       err == 'getaddrinfo: Name could not be resolved at this time' then
+       err == 'getaddrinfo: Name could not be resolved at this time' or
+-- EAI_NONAME
+       err == 'getaddrinfo: No address associated with hostname' then
         return true
     end
     return false
diff --git a/test/app/gh-4138-getaddrinfo-errors.test.lua b/test/app/gh-4138-getaddrinfo-errors.test.lua
index c8bb52939..a9ee2ee00 100644
--- a/test/app/gh-4138-getaddrinfo-errors.test.lua
+++ b/test/app/gh-4138-getaddrinfo-errors.test.lua
@@ -18,7 +18,9 @@ function check_err(err)
 -- EAI_AGAIN
        err == 'getaddrinfo: Temporary failure in name resolution' or
 -- EAI_AGAIN
-       err == 'getaddrinfo: Name could not be resolved at this time' then
+       err == 'getaddrinfo: Name could not be resolved at this time' or
+-- EAI_NONAME
+       err == 'getaddrinfo: No address associated with hostname' then
         return true
     end
     return false
diff --git a/test/box/net.box_getaddrinfo_errors_gh-4138.result b/test/box/net.box_getaddrinfo_errors_gh-4138.result
index 08bf6a9eb..bb35cb0bc 100644
--- a/test/box/net.box_getaddrinfo_errors_gh-4138.result
+++ b/test/box/net.box_getaddrinfo_errors_gh-4138.result
@@ -28,7 +28,9 @@ function check_err(err)
 -- EAI_AGAIN
        err == 'getaddrinfo: Temporary failure in name resolution' or
 -- EAI_AGAIN
-       err == 'getaddrinfo: Name could not be resolved at this time' then
+       err == 'getaddrinfo: Name could not be resolved at this time' or
+-- EAI_NONAME
+       err == 'getaddrinfo: No address associated with hostname' then
             return true
     end
     return false
diff --git a/test/box/net.box_getaddrinfo_errors_gh-4138.test.lua b/test/box/net.box_getaddrinfo_errors_gh-4138.test.lua
index 4eeddcdbd..92d150c23 100755
--- a/test/box/net.box_getaddrinfo_errors_gh-4138.test.lua
+++ b/test/box/net.box_getaddrinfo_errors_gh-4138.test.lua
@@ -18,7 +18,9 @@ function check_err(err)
 -- EAI_AGAIN
        err == 'getaddrinfo: Temporary failure in name resolution' or
 -- EAI_AGAIN
-       err == 'getaddrinfo: Name could not be resolved at this time' then
+       err == 'getaddrinfo: Name could not be resolved at this time' or
+-- EAI_NONAME
+       err == 'getaddrinfo: No address associated with hostname' then
             return true
     end
     return false
diff --git a/test/unit/coio.cc b/test/unit/coio.cc
index 69f78829c..01a708358 100644
--- a/test/unit/coio.cc
+++ b/test/unit/coio.cc
@@ -106,12 +106,16 @@ test_getaddrinfo(void)
 	/* EAI_AGAIN */
 	const char *exp_errmsg_6 = "getaddrinfo: Name could not be resolved at "
 		"this time";
+	/* EAI_NONAME */
+	const char *exp_errmsg_7 = "getaddrinfo: No address associated with "
+		"hostname";
 	bool is_match_with_exp = strcmp(errmsg, exp_errmsg_1) == 0 ||
 		strcmp(errmsg, exp_errmsg_2) == 0 ||
 		strcmp(errmsg, exp_errmsg_3) == 0 ||
 		strcmp(errmsg, exp_errmsg_4) == 0 ||
 		strcmp(errmsg, exp_errmsg_5) == 0 ||
-		strcmp(errmsg, exp_errmsg_6) == 0;
+		strcmp(errmsg, exp_errmsg_6) == 0 ||
+		strcmp(errmsg, exp_errmsg_7) == 0;
 	is(is_match_with_exp, true, "getaddrinfo error message");
 
 	/*
-- 
2.24.3 (Apple Git-128)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Tarantool-patches] [PATCH] test: fix getaddrinfo test on Ubuntu 16.04
  2020-12-12  3:51 [Tarantool-patches] [PATCH] test: fix getaddrinfo test on Ubuntu 16.04 Roman Khabibov
@ 2021-03-15 17:48 ` Alexander Turenko via Tarantool-patches
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Turenko via Tarantool-patches @ 2021-03-15 17:48 UTC (permalink / raw)
  To: Roman Khabibov; +Cc: tarantool-patches, Roman Khabibov, Sergey Bronnikov

> diff --git a/test/app/gh-4138-getaddrinfo-errors.result b/test/app/gh-4138-getaddrinfo-errors.result
> index d301e3776..62b0721df 100644
> --- a/test/app/gh-4138-getaddrinfo-errors.result
> +++ b/test/app/gh-4138-getaddrinfo-errors.result
> @@ -28,7 +28,9 @@ function check_err(err)
>  -- EAI_AGAIN
>         err == 'getaddrinfo: Temporary failure in name resolution' or
>  -- EAI_AGAIN
> -       err == 'getaddrinfo: Name could not be resolved at this time' then
> +       err == 'getaddrinfo: Name could not be resolved at this time' or
> +-- EAI_NONAME
> +       err == 'getaddrinfo: No address associated with hostname' then

It is EAI_NODATA, not EAI_NONAME:

 | $ gcc -D_GNU_SOURCE -Wall -Wextra -x c <(echo -e '#include <sys/types.h>\n#include <sys/socket.h>\n#include <netdb.h>\n#include <stdio.h>\nint main() { printf("%s\\n", gai_strerror(EAI_NONAME)); return 0; }') && ./a.out; rm a.out
 | Name or service not known
 | $ gcc -D_GNU_SOURCE -Wall -Wextra -x c <(echo -e '#include <sys/types.h>\n#include <sys/socket.h>\n#include <netdb.h>\n#include <stdio.h>\nint main() { printf("%s\\n", gai_strerror(EAI_NODATA)); return 0; }') && ./a.out; rm a.out
 | No address associated with hostname

Anyway, we meet another miscompare after updating FreeBSD from 12.0 to
12.2 (see [1]), so we finally decided to don't check exact error
messages. It appears to be too fragile: it depends on OS and network
conditions both. The patch 'test: simplify check of error message from
getaddrinfo()' from [2] will handle it.

[1]: https://github.com/tarantool/tarantool-qa/issues/94
[2]: https://github.com/tarantool/tarantool/pull/5751

WBR, Alexander Turenko.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-15 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12  3:51 [Tarantool-patches] [PATCH] test: fix getaddrinfo test on Ubuntu 16.04 Roman Khabibov
2021-03-15 17:48 ` Alexander Turenko via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox