From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 26 Mar 2019 19:14:13 +0300 From: Vladimir Davydov Subject: Re: [PATCH v1 1/1] box: allow box.session{.exists, .fd} without args Message-ID: <20190326161413.pvzzmljwdenmchpb@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: 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")