Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v1] test: enable unix sockets at sql-tap suite
@ 2019-08-16 13:27 Alexander V. Tikhonov
  2019-08-19 14:01 ` [tarantool-patches] " Alexander Turenko
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander V. Tikhonov @ 2019-08-16 13:27 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: Alexander V. Tikhonov, tarantool-patches

Set hard-coded unix sockets for iproto connections for all the
tests that used LISTEN test-run environment variable at all
*-tap suites which used core = app in suites.ini configuration
files, because 'app' core in test-run didn't provide the ability
to use unix sockets. It 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')

Follows up #4008
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4008-unix_sockets_iproto_sql_tap
Issue: https://github.com/tarantool/tarantool/issues/4008

 test/app-tap/init_script.test.lua                    | 7 ++++++-
 test/box-tap/auth.test.lua                           | 6 +++++-
 test/box-tap/session.test.lua                        | 7 +++++--
 test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua | 6 +++++-
 4 files changed, 21 insertions(+), 5 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/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/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)
-- 
2.17.1

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

* [tarantool-patches] Re: [PATCH v1] test: enable unix sockets at sql-tap suite
  2019-08-16 13:27 [tarantool-patches] [PATCH v1] test: enable unix sockets at sql-tap suite Alexander V. Tikhonov
@ 2019-08-19 14:01 ` Alexander Turenko
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Turenko @ 2019-08-19 14:01 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

I don't have objections against the approach in general. I think it is
not a big deal to implement it right in test-run under a separate
suite.ini option, but anyway let's fix it in the way you consider more
productive.

I would look whether we can fix all *-tap tests in this way at once (see
below) and I have a minor comments re commit message (see below too).

WBR, Alexander Turenko.

The title is the following:

> test: enable unix sockets at sql-tap suite

However the commit adds it to other *-tap test suites.

On Fri, Aug 16, 2019 at 04:27:25PM +0300, Alexander V. Tikhonov wrote:
> Set hard-coded unix sockets for iproto connections for all the
> tests that used LISTEN test-run environment variable at all
> *-tap suites which used core = app in suites.ini configuration
> files, because 'app' core in test-run didn't provide the ability
> to use unix sockets. It helped to handle the problem with
> 'Address already in use' error.
> Check the previous commit that set the use of sockets:

...of unix sockets?

> 
> 60f84cbfca24e3a91cea067c923e006b44ee589f ('test: use unix sockets for iproto connections')
> 
> Follows up #4008

I would file an issue to test-run (re ability to use a unix socket as
listen one in core = 'app') and mention it here, but up to you.

> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4008-unix_sockets_iproto_sql_tap
> Issue: https://github.com/tarantool/tarantool/issues/4008
> 
>  test/app-tap/init_script.test.lua                    | 7 ++++++-
>  test/box-tap/auth.test.lua                           | 6 +++++-
>  test/box-tap/session.test.lua                        | 7 +++++--
>  test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua | 6 +++++-

There are also LISTEN environment variable usages in
test/app-tap/tarantoolctl.test.lua and test/app-tap/debug.test.lua (in
the file test/app-tap/debug/server.lua). Is it doable to fix all that
places at once?

>  4 files changed, 21 insertions(+), 5 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/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/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)
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2019-08-19 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 13:27 [tarantool-patches] [PATCH v1] test: enable unix sockets at sql-tap suite Alexander V. Tikhonov
2019-08-19 14:01 ` [tarantool-patches] " Alexander Turenko

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