Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua"
@ 2019-07-15 10:20 imeevma
  2019-07-15 22:13 ` [tarantool-patches] " Vladislav Shpilevoy
  2019-07-18  4:27 ` Kirill Yukhin
  0 siblings, 2 replies; 3+ messages in thread
From: imeevma @ 2019-07-15 10:20 UTC (permalink / raw)
  To: v.shpilevoy; +Cc: avtikhon, tarantool-patches

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

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

end of thread, other threads:[~2019-07-18  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 10:20 [tarantool-patches] [PATCH v1 1/1] box: increase connection timeout in "net.box.test.lua" imeevma
2019-07-15 22:13 ` [tarantool-patches] " Vladislav Shpilevoy
2019-07-18  4:27 ` Kirill Yukhin

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