[Tarantool-patches] [PATCH] box: netbox.self and connect should work interchangeably
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Wed Mar 4 01:49:12 MSK 2020
Thanks for the patch!
See 2 comments below.
> diff --git a/test/box/gh-4513-netbox-self-and-connect-interchangeable.result b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result
> new file mode 100644
> index 000000000..fa41b2442
> --- /dev/null
> +++ b/test/box/gh-4513-netbox-self-and-connect-interchangeable.result
> @@ -0,0 +1,44 @@
> +-- test-run result file version 2
> +netbox = require('net.box')
> + | ---
> + | ...
> +test_run = require('test_run').new()
> + | ---
> + | ...
> +remote = test_run:get_cfg('remote') == 'true'
> + | ---
> + | ...
> +test_run:cmd("setopt delimiter ';'")
> + | ---
> + | - true
> + | ...
> +
> +nb = nil
> +if remote then
> + box.schema.user.grant('guest','super')
1. Grant was given, but was not revoked. This can affect next
tests running on the same instance.
> + nb = netbox.connect(box.cfg.listen)
> +else
> + nb = netbox.self
> +end;
> + | ---
> + | ...
> +test_run:cmd("setopt delimiter ''");
2. We have a nice syntax of '\' to create multi-line expressions
like this. For such a small piece of code this would look better
than 2 'setopt delimiter', IMO. Up to you.
> + | ---
> + | - true
> + | ...
> +
> +--
> +-- netbox:self and netbox:connect should work interchangeably
> +--
> +type(nb:eval('return box.tuple.new{1}')) -- table
> + | ---
> + | - table
> + | ...
> +type(nb:eval('return box.error.new(1, "test error")')) -- string
> + | ---
> + | - string
> + | ...
> +type(nb:eval('return box.NULL')) -- cdata
> + | ---
> + | - cdata
> + | ...
More information about the Tarantool-patches
mailing list