[Tarantool-patches] [PATCH v1] test: set unix sockets for iproto at core = app
Alexander V. Tikhonov
avtikhon at tarantool.org
Thu May 14 11:06:06 MSK 2020
Set hard-coded unix sockets for iproto connections at core = app.
Added its option in *-tap/suites.ini files and fixed tests for it.
Fix helped to handle the problem with 'Address already in use' error.
Check the previous commit that set the use of sockets:
60f84cbfca24e3a91cea067c923e006b44ee589f ('test: use unix sockets for iproto connections')
Closes #4459
---
Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4008-unix_sockets_iproto_sql_tap
Issue: https://github.com/tarantool/tarantool/issues/4459
test/app-tap/init_script.test.lua | 7 ++++++-
test/app-tap/suite.ini | 1 +
test/app-tap/tarantoolctl.test.lua | 4 ++--
test/box-tap/auth.test.lua | 6 +++++-
test/box-tap/session.test.lua | 7 +++++--
test/box-tap/suite.ini | 1 +
test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua | 6 +++++-
test/sql-tap/suite.ini | 1 +
8 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/test/app-tap/init_script.test.lua b/test/app-tap/init_script.test.lua
index 155f149a7..d7cea7c40 100755
--- a/test/app-tap/init_script.test.lua
+++ b/test/app-tap/init_script.test.lua
@@ -2,8 +2,12 @@
--
-- Testing init script
--
+
+local LISTEN_SOCKET = 'init_script.listen.sock'
+
+os.remove(LISTEN_SOCKET)
box.cfg{
- listen = os.getenv("LISTEN"),
+ listen = 'unix/:./' .. LISTEN_SOCKET,
pid_file = "box.pid",
memtx_memory=107374182,
log="tarantool.log"
@@ -86,4 +90,5 @@ fiber.sleep(0.0)
assert (require ~= nil)
space:drop()
+os.remove(LISTEN_SOCKET)
os.exit()
diff --git a/test/app-tap/suite.ini b/test/app-tap/suite.ini
index 9629dfad5..daababef5 100644
--- a/test/app-tap/suite.ini
+++ b/test/app-tap/suite.ini
@@ -4,3 +4,4 @@ description = application server tests (TAP)
lua_libs = lua/require_mod.lua lua/serializer_test.lua
is_parallel = True
pretest_clean = True
+use_unix_sockets_iproto = True
diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 4d7059559..675e511dd 100755
--- a/test/app-tap/tarantoolctl.test.lua
+++ b/test/app-tap/tarantoolctl.test.lua
@@ -465,12 +465,12 @@ else
local remote_path = create_script(dir, 'remote.lua', remote_code)
test_run:cmd(("create server remote with script='%s'"):format(remote_path))
test_run:cmd("start server remote")
- local port = tonumber(
+ local admin_socket = tostring(
test_run:eval("remote",
"return require('uri').parse(box.cfg.listen).service")[1]
)
- local command_base = ('tarantoolctl play localhost:%d filler/00000000000000000000.xlog'):format(port)
+ local command_base = ('tarantoolctl play %s filler/00000000000000000000.xlog'):format(admin_socket)
local status, err = pcall(function()
test:test("fill and test play output", function(test_i)
diff --git a/test/box-tap/auth.test.lua b/test/box-tap/auth.test.lua
index 4e9879408..5d6687a33 100755
--- a/test/box-tap/auth.test.lua
+++ b/test/box-tap/auth.test.lua
@@ -6,8 +6,11 @@ local tap = require('tap')
local netbox = require('net.box')
local urilib = require('uri')
+local LISTEN_SOCKET = 'auth.listen.sock'
+os.remove(LISTEN_SOCKET)
+
box.cfg {
- listen = os.getenv('LISTEN');
+ listen = 'unix/:./' .. LISTEN_SOCKET,
log="tarantool.log";
memtx_memory=100*1024*1024;
}
@@ -163,4 +166,5 @@ space:drop()
box.schema.user.drop('test', { if_exists = true})
box.schema.user.drop("test2", { if_exists = true})
+os.remove(LISTEN_SOCKET)
os.exit(test:check() == true and 0 or -1)
diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua
index 5d4965533..333736d72 100755
--- a/test/box-tap/session.test.lua
+++ b/test/box-tap/session.test.lua
@@ -4,11 +4,13 @@ local tap = require('tap')
local test = tap.test('session')
local fiber = require('fiber')
+local LISTEN_SOCKET = 'session.listen.sock'
+
+os.remove(LISTEN_SOCKET)
box.cfg{
- listen = os.getenv('LISTEN');
+ listen = 'unix/:./' .. LISTEN_SOCKET,
log="tarantool.log";
}
-
local uri = require('uri').parse(box.cfg.listen)
local HOST, PORT = uri.host or 'localhost', uri.service
session = box.session
@@ -217,4 +219,5 @@ box.schema.user.revoke('guest', 'execute', 'function', 'f2')
inspector:cmd('stop server session with cleanup=1')
session = nil
+os.remove(LISTEN_SOCKET)
os.exit(test:check() == true and 0 or -1)
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index 8d9e32d3f..3cdef2131 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -3,5 +3,6 @@ core = app
description = Database tests with #! using TAP
is_parallel = True
pretest_clean = True
+use_unix_sockets_iproto = True
fragile = cfg.test.lua ; gh-4344
key_def.test.lua ; gh-4252
diff --git a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
index d4b597e35..412649df8 100755
--- a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
+++ b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
@@ -15,8 +15,11 @@ local IPROTO_OK = 0x00
local IPROTO_SCHEMA_VERSION = 0x05
local IPROTO_STATUS_KEY = 0x00
+local LISTEN_SOCKET = 'gh-4077.listen.sock'
+
+os.remove(LISTEN_SOCKET)
box.cfg({
- listen = os.getenv('LISTEN') or 'localhost:3301',
+ listen = 'unix/:./' .. LISTEN_SOCKET,
})
box.schema.user.grant('guest', 'read,write,execute', 'universe')
@@ -69,4 +72,5 @@ test:is_deeply(res, exp_res, 'verify inserted data')
box.execute('drop table T')
box.schema.user.revoke('guest', 'read,write,execute', 'universe')
+os.remove(LISTEN_SOCKET)
os.exit(test:check() == true and 0 or 1)
diff --git a/test/sql-tap/suite.ini b/test/sql-tap/suite.ini
index 8f3c3eab1..0e8498875 100644
--- a/test/sql-tap/suite.ini
+++ b/test/sql-tap/suite.ini
@@ -29,5 +29,6 @@ long_run = gh-3332-tuple-format-leak.test.lua, gh-3083-ephemeral-unref-tuples.te
config = engine.cfg
show_reproduce_content = False
pretest_clean = True
+use_unix_sockets_iproto = True
fragile = gh-4077-iproto-execute-no-bind.test.lua ; gh-4459
selectG.test.lua ; gh-4458
--
2.17.1
More information about the Tarantool-patches
mailing list