[tarantool-patches] Re: [PATCH] net.box: fix 'unique' index flag in net.box schema

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Apr 1 11:42:03 MSK 2019


> diff --git a/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua b/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua
> new file mode 100755
> index 000000000..04c576915
> --- /dev/null
> +++ b/test/box-tap/gh-4091-net.box-indexes-are-always-non-unique.test.lua

Please, just add a one line to box/net.box.lua. It does not help at all
to have a new file per each issue. This way looks bulky and hard to search
for something.

> @@ -0,0 +1,30 @@
> +#!/usr/bin/env tarantool
> +
> +local tap = require('tap')
> +local net_box = require('net.box')
> +local urilib = require('uri')
> +
> +box.cfg({
> +    listen = os.getenv('LISTEN') or 'localhost:3301',
> +})
> +
> +box.schema.user.grant('guest', 'read,write,execute', 'universe')
> +
> +box.schema.create_space('s')
> +box.space.s:create_index('pk')
> +box.space.s:create_index('sk', {unique = false})
> +
> +local test = tap.test('gh-4091-net.box-indexes-are-always-non-unique')
> +test:plan(2)
> +
> +local uri = urilib.parse(box.cfg.listen)
> +local uri = ('%s:%s'):format(uri.host or 'localhost', uri.service)
> +local conn = net_box.connect(uri)
> +
> +test:is(conn.space.s.index.pk.unique, true, 'unique index')
> +test:is(conn.space.s.index.sk.unique, false, 'non-unique index')
> +
> +box.space.s:drop()
> +box.schema.user.revoke('guest', 'read,write,execute', 'universe')
> +
> +os.exit(test:check() == true and 0 or 1)
> -- 
> 2.20.1
> 




More information about the Tarantool-patches mailing list