Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v1 1/1] box: allow box.session{.exists, .fd} without args
Date: Tue, 26 Mar 2019 19:14:13 +0300	[thread overview]
Message-ID: <20190326161413.pvzzmljwdenmchpb@esperanza> (raw)
In-Reply-To: <e66f604363e5b557491d08a57e0dc30808cc3570.1553094901.git.kshcherbatov@tarantool.org>

On Wed, Mar 20, 2019 at 06:18:33PM +0300, Kirill Shcherbatov wrote:
> diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua
> index 857bc643b..b6b08d209 100755
> --- a/test/box-tap/session.test.lua
> +++ b/test/box-tap/session.test.lua
> @@ -15,7 +15,7 @@ session = box.session
>  space = box.schema.space.create('tweedledum')
>  index = space:create_index('primary', { type = 'hash' })
>  
> -test:plan(55)
> +test:plan(56)
>  
>  ---
>  --- Check that Tarantool creates ADMIN session for #! script
> @@ -23,7 +23,7 @@ test:plan(55)
>  test:ok(session.exists(session.id()), "session is created")
>  test:isnil(session.peer(session.id()), "session.peer")
>  local ok, err = pcall(session.exists)

This patch renders this pcall() redundant

> -test:is(err, "session.exists(sid): bad arguments", "exists bad args #1")
> +test:ok(ok, "session.exists()")
>  ok, err = pcall(session.exists, 1, 2, 3)
>  test:is(err, "session.exists(sid): bad arguments", "exists bad args #2")
>  test:ok(not session.exists(1234567890), "session doesn't exist")
> @@ -166,6 +166,7 @@ test:is(
>  )
>  local uri = inspector:eval('session', 'box.cfg.listen')[1]
>  conn = net.box.connect(uri)
> +test:ok(conn:eval("return box.session.fd()"), "get session fd")

Would be more prudent to check that fd() == fd(id()).

>  test:ok(conn:eval("return box.session.exists(box.session.id())"), "remote session exist check")
>  test:isnt(conn:eval("return box.session.peer(box.session.id())"), nil, "remote session peer check")
>  test:ok(conn:eval("return box.session.peer() == box.session.peer(box.session.id())"), "remote session peer check")

Pushed to the master branch with the following changes:

diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua
index b6b08d20..5d496553 100755
--- a/test/box-tap/session.test.lua
+++ b/test/box-tap/session.test.lua
@@ -22,8 +22,7 @@ test:plan(56)
 ---
 test:ok(session.exists(session.id()), "session is created")
 test:isnil(session.peer(session.id()), "session.peer")
-local ok, err = pcall(session.exists)
-test:ok(ok, "session.exists()")
+test:ok(session.exists(), "session.exists")
 ok, err = pcall(session.exists, 1, 2, 3)
 test:is(err, "session.exists(sid): bad arguments", "exists bad args #2")
 test:ok(not session.exists(1234567890), "session doesn't exist")
@@ -166,10 +165,10 @@ test:is(
 )
 local uri = inspector:eval('session', 'box.cfg.listen')[1]
 conn = net.box.connect(uri)
-test:ok(conn:eval("return box.session.fd()"), "get session fd")
 test:ok(conn:eval("return box.session.exists(box.session.id())"), "remote session exist check")
 test:isnt(conn:eval("return box.session.peer(box.session.id())"), nil, "remote session peer check")
 test:ok(conn:eval("return box.session.peer() == box.session.peer(box.session.id())"), "remote session peer check")
+test:ok(conn:eval("return box.session.fd() == box.session.fd(box.session.id())"), "remote session fd check")
 
 -- gh-2994 session uid vs session effective uid
 test:is(session.euid(), 1, "session.uid")

      reply	other threads:[~2019-03-26 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 15:18 Kirill Shcherbatov
2019-03-26 16:14 ` Vladimir Davydov [this message]

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=20190326161413.pvzzmljwdenmchpb@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v1 1/1] box: allow box.session{.exists, .fd} without args' \
    /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