From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DD29A469719 for ; Fri, 14 Feb 2020 15:37:53 +0300 (MSK) Date: Fri, 14 Feb 2020 15:38:10 +0300 From: Alexander Turenko Message-ID: <20200214123810.g25udsubwpvtntyv@tkn_work_nb> References: <20200213130738.12063-1-gorcunov@gmail.com> <20200213135725.GO21061@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200213135725.GO21061@uranus> Subject: Re: [Tarantool-patches] [PATCH v2] test: box/errinj -- sort errors List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tml , Vladislav Shpilevoy 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 > --- 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