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 725402C664 for ; Thu, 18 Apr 2019 13:02:17 -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 JjCtiyeXuMnF for ; Thu, 18 Apr 2019 13:02:17 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 AE8482C607 for ; Thu, 18 Apr 2019 13:02:16 -0400 (EDT) Date: Thu, 18 Apr 2019 20:02:05 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH v3] Add status/messages upstream/downstream checker Message-ID: <20190418170204.cy4z3vux5me3yt2t@tkn_work_nb> References: <87c7e31b8fe3bbc8b7be975d32a22d51e684941e.1555435921.git.avtikhon@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87c7e31b8fe3bbc8b7be975d32a22d51e684941e.1555435921.git.avtikhon@tarantool.org> 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: avtikhon Cc: tarantool-patches@freelists.org Added logging, rewrote comments (using ldoc format), opened [PR #163][1]. Can you look into the PR, check successful and unsuccessful cases and look into the log message format (whether it looks usable)? [1]: https://github.com/tarantool/test-run/pull/163 WBR, Alexander Turenko. On Tue, Apr 16, 2019 at 08:32:15PM +0300, avtikhon wrote: > Added the common routine that check the upstream > and downstream status either message or both. > Wait default timeout until the given status and the message > will match the given pattern, if some flags are nil then it > will not be checked. When message is box.NULL expects > box.info.replication[id].message to be nil or box.NULL. > > Close #158 > --- > test_run.lua | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/test_run.lua b/test_run.lua > index 42d5e56..d0935e3 100644 > --- a/test_run.lua > +++ b/test_run.lua > @@ -227,6 +227,42 @@ local function switch(self, node) > return self:cmd(switch_cmd3:format(node)) > end > > +local function gen_box_info_replication_cond(id, status, message, field) > + return function() > + local info = box.info.replication[id][field] > + local ok = true > + if status ~= nil then > + ok = ok and info.status == status > + end > + if message ~= nil then > + ok = ok and info.message ~= nil and info.message:match(message) > + elseif type(message) ~= 'nil' then > + ok = ok and info.message == nil > + end > + return not not ok > + end > +end > + > +-- Wait default timeout until the given status and the message > +-- will match the given pattern, if some flags are nil then it > +-- will not be checked. > +-- when message is box.NULL expects > +-- box.info.replication[id].message to be nil or box.NULL. > +local function wait_upstream(self, id, status, message) > + return self:wait_cond(gen_box_info_replication_cond(id, status, message, > + 'upstream')) > +end > + > +-- Wait default timeout until the given status and the message > +-- will match the given pattern, if some flags are nil then it > +-- will not be checked. > +-- When message is box.NULL expects > +-- box.info.replication[id].message to be nil or box.NULL. > +local function wait_downstream(self, id, status, message) > + return self:wait_cond(gen_box_info_replication_cond(id, status, message, > + 'downstream')) > +end > + > local get_cfg_cmd = 'config %s' > > local function get_cfg(self, name) > @@ -360,6 +396,8 @@ local inspector_methods = { > wait_fullmesh = wait_fullmesh, > get_cluster_vclock = get_cluster_vclock, > wait_cluster_vclock = wait_cluster_vclock, > + wait_downstream = wait_downstream, > + wait_upstream = wait_upstream, > -- > grep_log = grep_log, > wait_cond = wait_cond, > -- > 2.17.1 >