[Tarantool-patches] [PATCH v2] test: box/errinj -- sort errors

Alexander Turenko alexander.turenko at tarantool.org
Fri Feb 14 15:38:10 MSK 2020


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 at 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


More information about the Tarantool-patches mailing list