Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [PATCH] test: fix hardcoded port in box/net.box.test.lua
Date: Sun,  2 Dec 2018 19:38:02 +0300	[thread overview]
Message-ID: <aff5f81aaea464a7467dd6418a28d8f833c2d35d.1543768397.git.alexander.turenko@tarantool.org> (raw)

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

             reply	other threads:[~2018-12-02 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-02 16:38 Alexander Turenko [this message]
2018-12-03  8:42 ` Vladimir Davydov

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=aff5f81aaea464a7467dd6418a28d8f833c2d35d.1543768397.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH] test: fix hardcoded port in box/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