Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: v.shpilevoy@tarantool.org
Cc: avtikhon@tarantool.org, tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua"
Date: Mon, 15 Jul 2019 13:20:38 +0300	[thread overview]
Message-ID: <667a69a7b37236d443212da8289c34d2bc56c722.1563185673.git.imeevma@gmail.com> (raw)

The "box/net.box.test.lua" test contains a check that the error
received contains a 'timed out'. But in cases when testing was
conducted on a slow computer or in the case of a very large load,
it is possible that the connection time-out will be reached
earlier than the mentioned error. In this case, the error "Invalid
argument" will be returned. To prevent this from happening,
this patch will increase the connection timeout.

Closes #4341
---
The patch was tested by @avtikhon. The specified error no longer
occurs.

https://github.com/tarantool/tarantool/issues/4341
https://github.com/tarantool/tarantool/tree/imeevma/gh-4341-increase-connection-timeout

 test/box/net.box.result   | 10 ++++++++--
 test/box/net.box.test.lua |  8 ++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/box/net.box.result b/test/box/net.box.result
index 6467629..0803956 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2109,6 +2109,9 @@ test_run:cmd("setopt delimiter ';'");
 ---
 - true
 ...
+need_stop = false;
+---
+...
 greeting =
 "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ..
 "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
@@ -2120,7 +2123,9 @@ socket = require('socket');
 srv = socket.tcp_server('localhost', 0, {
     handler = function(fd)
         local fiber = require('fiber')
-        fiber.sleep(0.1)
+        while not need_stop do
+            fiber.sleep(0.01)
+        end
         fd:write(greeting)
     end
 });
@@ -2130,7 +2135,7 @@ srv = socket.tcp_server('localhost', 0, {
 port = srv:name().port
 nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
-    connect_timeout = 0.01
+    connect_timeout = 0.1
 });
 ---
 ...
@@ -2138,6 +2143,7 @@ nb.error:find('timed out') ~= nil;
 ---
 - true
 ...
+need_stop = true
 nb:close();
 ---
 ...
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index a84f6db..3677b30 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -837,6 +837,7 @@ c:close()
 
 -- Test for connect_timeout > 0 in netbox connect
 test_run:cmd("setopt delimiter ';'");
+need_stop = false;
 greeting =
 "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ..
 "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
@@ -844,7 +845,9 @@ socket = require('socket');
 srv = socket.tcp_server('localhost', 0, {
     handler = function(fd)
         local fiber = require('fiber')
-        fiber.sleep(0.1)
+        while not need_stop do
+            fiber.sleep(0.01)
+        end
         fd:write(greeting)
     end
 });
@@ -852,9 +855,10 @@ port = srv:name().port
 -- we must get timeout
 nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
-    connect_timeout = 0.01
+    connect_timeout = 0.1
 });
 nb.error:find('timed out') ~= nil;
+need_stop = true
 nb:close();
 -- we must get peer closed
 nb = net.new('localhost:' .. port, {
-- 
2.7.4

             reply	other threads:[~2019-07-15 10:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 10:20 imeevma [this message]
2019-07-15 22:13 ` [tarantool-patches] " Vladislav Shpilevoy
2019-07-18  4:27 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=667a69a7b37236d443212da8289c34d2bc56c722.1563185673.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua"' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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