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 8CA312B95E for ; Tue, 16 Apr 2019 11:16:52 -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 0kN6pV9ceEkg for ; Tue, 16 Apr 2019 11:16:52 -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 4589F27AD1 for ; Tue, 16 Apr 2019 11:16:52 -0400 (EDT) From: avtikhon Subject: [tarantool-patches] [PATCH v2] Add the common routine to check streams status Date: Tue, 16 Apr 2019 18:16:47 +0300 Message-Id: <75639d11869e2811db22727d20f6b81cbd487d1f.1555427639.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: alexander.turenko@tarantool.org Cc: avtikhon , tarantool-patches@freelists.org Added the common routine that checks the upstream and downstream status. Also added ability to check the matching of the upstream and downstream messages. Close #158 --- Github: https://github.com/tarantool/test-run/tree/avtikhon/gh-158-wait-id-status Issue: https://github.com/tarantool/test-run/issues/158 test_run.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test_run.lua b/test_run.lua index 42d5e56..35dace4 100644 --- a/test_run.lua +++ b/test_run.lua @@ -227,6 +227,40 @@ local function switch(self, node) return self:cmd(switch_cmd3:format(node)) end +local function wait_status(self, id, status) + return self:wait_cond(function() return id.status == status end) or id.status +end + +local function wait_message(self, id, message) + return self:wait_cond(function() return id.message:match(message) end) or id.message +end + +local function wait_downstream(self, id, status, message) + if status ~= nil then + if message ~= nil then + return self:wait_message(id.downstream, message) + and self:wait_status(id.downstream, status) + end + return self:wait_status(id.downstream, status) + end + if message ~= nil then + return self:wait_message(id.downstream, message) + end +end + +local function wait_upstream(self, id, status, message) + if status ~= nil then + if message ~= nil then + return self:wait_message(id.upstream, message) + and self:wait_status(id.upstream, status) + end + return self:wait_status(id.upstream, status) + end + if message ~= nil then + return self:wait_message(id.upstream, message) + end +end + local get_cfg_cmd = 'config %s' local function get_cfg(self, name) @@ -360,6 +394,10 @@ local inspector_methods = { wait_fullmesh = wait_fullmesh, get_cluster_vclock = get_cluster_vclock, wait_cluster_vclock = wait_cluster_vclock, + wait_status = wait_status, + wait_message = wait_message, + wait_downstream = wait_downstream, + wait_upstream = wait_upstream, -- grep_log = grep_log, wait_cond = wait_cond, -- 2.17.1