From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 7728A27C07 for ; Thu, 19 Jul 2018 11:14:51 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vmk9_01-PjbE for ; Thu, 19 Jul 2018 11:14:51 -0400 (EDT) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id A3E1B27971 for ; Thu, 19 Jul 2018 11:14:50 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 1/3] Add test on error during reconfigure References: <0a1a6702a293c8f86f38d67c92f04da1f6c6a686.1531935745.git.avkhatskevich@tarantool.org> From: Vladislav Shpilevoy Message-ID: <069d5b60-cffa-c24c-06f9-9a9af1af8fcb@tarantool.org> Date: Thu, 19 Jul 2018 18:14:47 +0300 MIME-Version: 1.0 In-Reply-To: <0a1a6702a293c8f86f38d67c92f04da1f6c6a686.1531935745.git.avkhatskevich@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, AKhatskevich Hi! Thanks for the patch! See 3 comments below. On 18/07/2018 20:47, AKhatskevich wrote: > In case reconfigure process fails, the node should continue > work properly. > --- > test/lua_libs/util.lua | 16 ++++++++++++++++ > test/router/router.result | 33 +++++++++++++++++++++++++++++++++ > test/router/router.test.lua | 10 ++++++++++ > test/storage/storage.result | 39 +++++++++++++++++++++++++++++++++++++++ > test/storage/storage.test.lua | 12 ++++++++++++ > vshard/router/init.lua | 7 +++++++ > vshard/storage/init.lua | 9 +++++++++ > 7 files changed, 126 insertions(+) > > diff --git a/test/lua_libs/util.lua b/test/lua_libs/util.lua > index f2d3b48..aeb2342 100644 > --- a/test/lua_libs/util.lua > +++ b/test/lua_libs/util.lua > @@ -69,9 +69,25 @@ local function wait_master(test_run, replicaset, master) > log.info('Slaves are connected to a master "%s"', master) > end > > +-- Check that data has at least all fields as an ethalon. 1. Typo here and in other places: ethalon -> etalon. 2. Please, describe the function in doxygen style since it is not a trival one-liner. > +local function has_same_fields(ethalon, data) > + assert(type(ethalon) == 'table' and type(data) == 'table') > + local diff = {} > + for k, v in pairs(ethalon) do > + if v ~= data[k] then > + table.insert(diff, k) > + end > + end > + if #diff > 0 then > + return false, diff > + end > + return true > +end > + > return { > check_error = check_error, > shuffle_masters = shuffle_masters, > collect_timeouts = collect_timeouts, > wait_master = wait_master, > + has_same_fields = has_same_fields, > } > diff --git a/test/router/router.result b/test/router/router.result > index 15f4fd0..7ec3e15 100644 > --- a/test/router/router.result > +++ b/test/router/router.result > @@ -1156,6 +1156,39 @@ util.check_error(vshard.router.cfg, non_dynamic_cfg) > --- > - Non-dynamic option shard_index cannot be reconfigured > ... > +-- Error during reconfigure process. > +vshard.router.route(1):callro('echo', {'some_data'}) > +--- > +- some_data > +- null > +- null > +... > +vshard.router.internal.errinj.ERRINJ_CFG = true > +--- > +... > +old_internal = table.copy(vshard.router.internal) > +--- > +... > +_, err = pcall(vshard.router.cfg, cfg) > +--- > +... > +err:match('Error injection:.*') 3. P l e a s e. Again. Do not use pcall + match. Use util.check_error.