Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v2] test: box/errinj -- sort errors
Date: Fri, 14 Feb 2020 15:38:10 +0300	[thread overview]
Message-ID: <20200214123810.g25udsubwpvtntyv@tkn_work_nb> (raw)
In-Reply-To: <20200213135725.GO21061@uranus>

On Thu, Feb 13, 2020 at 04:57:25PM +0300, Cyrill Gorcunov wrote:
> Every new error inroduced into error engine
> cause massive update in test even if only one
> key is introduced.
> 
> To minimize diff output better print them in
> sorted order.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---

Pushed to master, 2.3, 2.2 and 1.10.

> diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua
> index 03c088677..083bc963c 100644
> --- a/test/box/errinj.test.lua
> +++ b/test/box/errinj.test.lua
> @@ -9,7 +9,17 @@ net_box = require('net.box')
>  space = box.schema.space.create('tweedledum')
>  index = space:create_index('primary', { type = 'hash' })
>  
> -errinj.info()
> +--
> +-- Print all error keys in sorted order
> +-- to minimize diff output when new ones
> +-- are merged in.
> +ekeys = {}
> +evals = {}
> +for k,v in pairs(errinj.info()) do ekeys[#ekeys+1] = k end
> +table.sort(ekeys)
> +for i = 1, #ekeys do evals[i] = string.format("%s = %s", ekeys[i], errinj.get(ekeys[i])) end
> +evals

Reformatted a bit:

 | --
 | -- Print all error keys in sorted order to minimize diff output
 | -- when new ones are merged in.
 | ekeys = {}
 | evals = {}
 | for k, v in pairs(errinj.info()) do \
 |     table.insert(ekeys, k)          \
 | end
 | table.sort(ekeys)
 | for i, k in ipairs(ekeys) do         \ 
 |     evals[i] = {[k] = errinj.get(k)} \ 
 | end
 | evals

      parent reply	other threads:[~2020-02-14 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 13:07 [Tarantool-patches] [PATCH] " Cyrill Gorcunov
2020-02-13 13:57 ` [Tarantool-patches] [PATCH v2] " Cyrill Gorcunov
2020-02-13 21:59   ` Vladislav Shpilevoy
2020-02-14 12:38   ` Alexander Turenko [this message]

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=20200214123810.g25udsubwpvtntyv@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2] test: box/errinj -- sort errors' \
    /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