<HTML><BODY><div><div>Thank you for the review! Fixes are done:</div><hr><div><div>Branch:</div><div><a href="https://github.com/tarantool/tarantool/compare/eljashm/gh-4513-netbox.self-convert-tuples-to-table-type">https://github.com/tarantool/tarantool/compare/eljashm/gh-4513-netbox.self-convert-tuples-to-table-type</a> </div><div> </div><div> src/box/lua/net_box.lua                       |  8 +++-<br> test/app-tap/debug.result                     |  8 ++--<br> test/box/engine.cfg                           |  6 +++<br> ...ox-self-and-connect-interchangeable.result | 45 +++++++++++++++++++<br> ...-self-and-connect-interchangeable.test.lua | 23 ++++++++++<br> test/box/suite.ini                            |  1 +<br> 6 files changed, 86 insertions(+), 5 deletions(-)<br> create mode 100644 test/box/engine.cfg<br> create mode 100644 test/box/gh-4513-netbox-self-and-connect-interchangeable.result<br> create mode 100644 test/box/gh-4513-netbox-self-and-connect-interchangeable.test.lua</div><div> </div><div>diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua<br>index b4811edfa..3f611c027 100644<br>--- a/src/box/lua/net_box.lua<br>+++ b/src/box/lua/net_box.lua<br>@@ -1550,7 +1550,13 @@ local function handle_eval_result(status, ...)<br>         rollback()<br>         return box.error(E_PROC_LUA, (...))<br>     end<br>-    return ...<br>+    local results = {...}<br>+    for i = 1, select('#', ...) do<br>+        if type(results[i]) == 'cdata' then<br>+            results[i] = msgpack.decode(msgpack.encode(results[i]))<br>+        end<br>+    end<br>+    return unpack(results)<br> end<br> <br> this_module.self = {</div><div> </div><div>diff --git a/test/app-tap/debug.result b/test/app-tap/debug.result<br>index 72934b076..cdc990307 100644<br>--- a/test/app-tap/debug.result<br>+++ b/test/app-tap/debug.result<br>@@ -15,15 +15,15 @@ nil<br> Exec: tarantool -e "print(debug.__dir__); os.exit(0)"<br> .<br> Exec: tarantool -e "print(require('net.box').self:call('debug.sourcefile')); os.exit(0)"<br>-nil<br>+<br> Exec: tarantool -e "print(require('net.box').self:call('debug.sourcedir')); os.exit(0)"<br> .<br> Exec: tarantool -e "fn = function() return debug.__file__ end; print(require('net.box').self:call('fn')); os.exit(0)"<br>-nil<br>+<br> Exec: tarantool -e "fn = function() return debug.__dir__ end; print(require('net.box').self:call('fn')); os.exit(0)"<br> .<br> Exec: tarantool -e "fn = function() local res = debug.sourcefile(); return res end; print(require('net.box').self:call('fn')); os.exit(0)"<br>-nil<br>+<br> Exec: tarantool -e "fn = function() local res = debug.sourcedir(); return res end; print(require('net.box').self:call('fn')); os.exit(0)"<br> .<br> Exec: tarantool -e "print(loadstring('return debug.sourcefile()')()); os.exit(0)"<br>@@ -52,7 +52,7 @@ debug/test.lua<br> Source: print(debug.__dir__)<br> debug<br> Source: print(require('net.box').self:call('debug.sourcefile'))<br>-nil<br>+<br> Source: print(require('net.box').self:call('debug.sourcedir'))<br> .<br> Source: fn = function() return debug.__file__ end; print(require('net.box').self:call('fn'))<br>diff --git a/test/box/engine.cfg b/test/box/engine.cfg<br>new file mode 100644<br>index 000000000..2d1d450e3<br>--- /dev/null<br>+++ b/test/box/engine.cfg<br>@@ -0,0 +1,6 @@<br>+{<br>+    "gh-4513-netbox-self-and-connect-interchangeable.test.lua": {<br>+        "remote": {"remote": "true"},<br>+        "local": {"remote": "false"}<br>+    }<br>+}</div><div> </div><div>diff --git a/test/box/gh-4513-netbox-self-and-connect-interchangeable.result b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result<br>new file mode 100644<br>index 000000000..67000f9c8<br>--- /dev/null<br>+++ b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result<br>@@ -0,0 +1,45 @@<br>+-- test-run result file version 2<br>+netbox = require('net.box')<br>+ | ---<br>+ | ...<br>+test_run = require('test_run').new()<br>+ | ---<br>+ | ...<br>+remote = test_run:get_cfg('remote') == 'true'<br>+ | ---<br>+ | ...<br>+<br>+nb = nil<br>+ | ---<br>+ | ...<br>+if remote then \<br>+    box.schema.user.grant('guest','super') \<br>+    nb = netbox.connect(box.cfg.listen) \<br>+else \<br>+    nb = netbox.self \<br>+end<br>+ | ---<br>+ | ...<br>+<br>+--<br>+-- netbox:self and netbox:connect should work interchangeably<br>+--<br>+type(nb:eval('return box.tuple.new{1}')) -- table<br>+ | ---<br>+ | - table<br>+ | ...<br>+type(nb:eval('return box.error.new(1, "test error")')) -- string<br>+ | ---<br>+ | - string<br>+ | ...<br>+type(nb:eval('return box.NULL')) -- cdata<br>+ | ---<br>+ | - cdata<br>+ | ...<br>+<br>+if remote then \<br>+    box.schema.user.revoke('guest', 'super') \<br>+    nb:close() \<br>+end<br>+ | ---<br>+ | ...</div><div> </div><div>diff --git a/test/box/gh-4513-netbox-self-and-connect-interchangeable.test.lua b/test/box/gh-4513-netbox-self-and-connect-interchangeable.test.lua<br>new file mode 100644<br>index 000000000..010d6cf34<br>--- /dev/null<br>+++ b/test/box/gh-4513-netbox-self-and-connect-interchangeable.test.lua<br>@@ -0,0 +1,23 @@<br>+netbox = require('net.box')<br>+test_run = require('test_run').new()<br>+remote = test_run:get_cfg('remote') == 'true'<br>+<br>+nb = nil<br>+if remote then \<br>+    box.schema.user.grant('guest','super') \<br>+    nb = netbox.connect(box.cfg.listen) \<br>+else \<br>+    nb = netbox.self \<br>+end<br>+<br>+--<br>+-- netbox:self and netbox:connect should work interchangeably<br>+--<br>+type(nb:eval('return box.tuple.new{1}')) -- table<br>+type(nb:eval('return box.error.new(1, "test error")')) -- string<br>+type(nb:eval('return box.NULL')) -- cdata<br>+<br>+if remote then \<br>+    box.schema.user.revoke('guest', 'super') \<br>+    nb:close() \<br>+end</div><div> </div><div>diff --git a/test/box/suite.ini b/test/box/suite.ini<br>index 9aa30ede6..01f07236b 100644<br>--- a/test/box/suite.ini<br>+++ b/test/box/suite.ini<br>@@ -3,6 +3,7 @@ core = tarantool<br> description = Database tests<br> script = box.lua<br> disabled = rtree_errinj.test.lua tuple_bench.test.lua<br>+config = engine.cfg<br> release_disabled = errinj.test.lua errinj_index.test.lua rtree_errinj.test.lua upsert_errinj.test.lua iproto_stress.test.lua gh-4648-func-load-unload.test.lua<br> lua_libs = lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua lua/push.lua lua/identifier.lua<br> use_unix_sockets = True<br>-- <br>2.24.0</div></div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Среда, 4 марта 2020, 1:49 +03:00 от Vladislav Shpilevoy <v.shpilevoy@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15832757541287154620_BODY">Thanks for the patch!<br><br>See 2 comments below.<br><br>> diff --git a/test/box/gh-4513-netbox-self-and-connect-interchangeable.result b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result<br>> new file mode 100644<br>> index 000000000..fa41b2442<br>> --- /dev/null<br>> +++ b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result<br>> @@ -0,0 +1,44 @@<br>> +-- test-run result file version 2<br>> +netbox = require('net.box')<br>> + | ---<br>> + | ...<br>> +test_run = require('test_run').new()<br>> + | ---<br>> + | ...<br>> +remote = test_run:get_cfg('remote') == 'true'<br>> + | ---<br>> + | ...<br>> +test_run:cmd("setopt delimiter ';'")<br>> + | ---<br>> + | - true<br>> + | ...<br>> +<br>> +nb = nil<br>> +if remote then<br>> + box.schema.user.grant('guest','super')<br><br>1. Grant was given, but was not revoked. This can affect next<br>tests running on the same instance.<br><br>> + nb = netbox.connect(box.cfg.listen)<br>> +else<br>> + nb = netbox.self<br>> +end;<br>> + | ---<br>> + | ...<br>> +test_run:cmd("setopt delimiter ''");<br><br>2. We have a nice syntax of '\' to create multi-line expressions<br>like this. For such a small piece of code this would look better<br>than 2 'setopt delimiter', IMO. Up to you.<br><br>> + | ---<br>> + | - true<br>> + | ...<br>> +<br>> +--<br>> +-- netbox:self and netbox:connect should work interchangeably<br>> +--<br>> +type(nb:eval('return box.tuple.new{1}')) -- table<br>> + | ---<br>> + | - table<br>> + | ...<br>> +type(nb:eval('return box.error.new(1, "test error")')) -- string<br>> + | ---<br>> + | - string<br>> + | ...<br>> +type(nb:eval('return box.NULL')) -- cdata<br>> + | ---<br>> + | - cdata<br>> + | ...<br> </div></div></div></div></blockquote> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Maria Khaydich</div></div></div><div> </div></div></BODY></HTML>