Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	AKhatskevich <avkhatskevich@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 1/3] Do not force login/pass in URI
Date: Sat, 23 Jun 2018 01:11:54 +0300	[thread overview]
Message-ID: <ea1c3fbc-71ac-3153-4eb0-31e8f8994e30@tarantool.org> (raw)
In-Reply-To: <cf05a301eb7ddf7a714d0c796f000b8c5d62e506.1529703268.git.avkhatskevich@tarantool.org>

Hello. Thanks for the patch! See 3 comments below.

On 23/06/2018 00:43, AKhatskevich wrote:
> All access rights would be checked explicitly by Tarantool.
> 
> Closes #47
> ---
>   test/unit/config.result   | 14 ++++++++++++++
>   test/unit/config.test.lua |  6 ++++++
>   vshard/cfg.lua            |  7 +++----
>   3 files changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/test/unit/config.result b/test/unit/config.result
> index 6b4f87b..847536c 100644
> --- a/test/unit/config.result
> +++ b/test/unit/config.result
> @@ -506,3 +506,17 @@ _ = lcfg.check(cfg)
>   replica.name = 'storage'
>   ---
>   ...
> +-- gh-47: Check uri
> +_, err = pcall(lcfg.check_uri, 'invalid uri')
> +---
> +...
> +err:match('Invalid URI.*')

1. Please, use util.check_error instead of pcall + match as
I told you earlier.

> diff --git a/vshard/cfg.lua b/vshard/cfg.lua
> index f5db4c0..5644d2c 100644
> --- a/vshard/cfg.lua
> +++ b/vshard/cfg.lua
> @@ -5,10 +5,8 @@ local luri = require('uri')
>   local consts = require('vshard.consts')
>   
>   local function check_uri(uri)
> -    uri = luri.parse(uri)
> -    if uri.login == nil or uri.password == nil then
> -        error('URI must contain login and password')
> -    end
> +    local parsed = luri.parse(uri)
> +    assert(parsed, 'Invalid URI: ' .. uri)

2. Please, do not assertions for regular errors. Use 'error()'.

>   end
>   
>   local function check_master(master, ctx)
> @@ -251,5 +249,6 @@ end
>   
>   return {
>       check = cfg_check,
> +    check_uri = check_uri,

3. Do not expose this one-line function for testing only. Just
use cfg.check for this corrupting an uri of a replica in cfg.

And restore back after the test.

>       remove_non_box_options = remove_non_box_options,
>   }
> 

  reply	other threads:[~2018-06-22 22:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 21:43 [tarantool-patches] [PATCH 0/3][vshard] Small patches AKhatskevich
2018-06-22 21:43 ` [tarantool-patches] [PATCH 1/3] Do not force login/pass in URI AKhatskevich
2018-06-22 22:11   ` Vladislav Shpilevoy [this message]
2018-06-25 21:56     ` [tarantool-patches] " Alex Khatskevich
2018-06-26 11:11       ` Vladislav Shpilevoy
2018-06-22 21:43 ` [tarantool-patches] [PATCH 2/3] Allow use existing user AKhatskevich
2018-06-22 22:12   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-25 21:55     ` Alex Khatskevich
2018-06-26 11:11       ` Vladislav Shpilevoy
2018-06-22 21:43 ` [tarantool-patches] [PATCH 3/3] Introduce destroy module feature AKhatskevich
2018-06-22 22:11   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-25 21:54     ` Alex Khatskevich
2018-06-26 11:11       ` Vladislav Shpilevoy

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=ea1c3fbc-71ac-3153-4eb0-31e8f8994e30@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=avkhatskevich@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 1/3] Do not force login/pass in URI' \
    /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