Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] test: fix hardcoded port in box/net.box.test.lua
@ 2018-12-02 16:38 Alexander Turenko
  2018-12-03  8:42 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Turenko @ 2018-12-02 16:38 UTC (permalink / raw)
  To: Vladimir Davydov; +Cc: Alexander Turenko, tarantool-patches

It allows to run the test many times in parallel to investigate flaky
test failures and decreases probability that the test fails, because
this port was already used by, say, some other test.
---

no issue
https://github.com/tarantool/tarantool/tree/Totktonada/fix-hardcoded-port-in-net.box.test.lua

The patch was created to reproduce the issue #3851.

https://github.com/tarantool/tarantool/issues/3851

The branch is based on top of 2.1.

I think it also good to cherry-pick test fixes to 1.10, but it is up to
maintainers.

 test/box/net.box.result   | 7 ++++---
 test/box/net.box.test.lua | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/test/box/net.box.result b/test/box/net.box.result
index 4f6979d5b..faae5e9a5 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -1880,7 +1880,7 @@ greeting =
 socket = require('socket');
 ---
 ...
-srv = socket.tcp_server('localhost', 3392, {
+srv = socket.tcp_server('localhost', 0, {
     handler = function(fd)
         local fiber = require('fiber')
         fiber.sleep(0.1)
@@ -1890,7 +1890,8 @@ srv = socket.tcp_server('localhost', 3392, {
 ---
 ...
 -- we must get timeout
-nb = net.new('localhost:3392', {
+port = srv:name().port
+nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
     connect_timeout = 0.01
 });
@@ -1904,7 +1905,7 @@ nb:close();
 ---
 ...
 -- we must get peer closed
-nb = net.new('localhost:3392', {
+nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
     connect_timeout = 0.2
 });
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index 5201e01a6..dd6c2fd94 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -754,22 +754,23 @@ greeting =
 "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ..
 "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
 socket = require('socket');
-srv = socket.tcp_server('localhost', 3392, {
+srv = socket.tcp_server('localhost', 0, {
     handler = function(fd)
         local fiber = require('fiber')
         fiber.sleep(0.1)
         fd:write(greeting)
     end
 });
+port = srv:name().port
 -- we must get timeout
-nb = net.new('localhost:3392', {
+nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
     connect_timeout = 0.01
 });
 nb.error:find('timed out') ~= nil;
 nb:close();
 -- we must get peer closed
-nb = net.new('localhost:3392', {
+nb = net.new('localhost:' .. port, {
     wait_connected = true, console = true,
     connect_timeout = 0.2
 });
-- 
2.19.2

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

* Re: [PATCH] test: fix hardcoded port in box/net.box.test.lua
  2018-12-02 16:38 [PATCH] test: fix hardcoded port in box/net.box.test.lua Alexander Turenko
@ 2018-12-03  8:42 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2018-12-03  8:42 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

On Sun, Dec 02, 2018 at 07:38:02PM +0300, Alexander Turenko wrote:
> It allows to run the test many times in parallel to investigate flaky
> test failures and decreases probability that the test fails, because
> this port was already used by, say, some other test.
> ---
> 
> no issue
> https://github.com/tarantool/tarantool/tree/Totktonada/fix-hardcoded-port-in-net.box.test.lua
> 
> The patch was created to reproduce the issue #3851.
> 
> https://github.com/tarantool/tarantool/issues/3851
> 
> The branch is based on top of 2.1.
> 
> I think it also good to cherry-pick test fixes to 1.10, but it is up to
> maintainers.

Pushed to 2.1 and 1.10.

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

end of thread, other threads:[~2018-12-03  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-02 16:38 [PATCH] test: fix hardcoded port in box/net.box.test.lua Alexander Turenko
2018-12-03  8:42 ` Vladimir Davydov

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