From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id BA1546FC82; Fri, 12 Nov 2021 02:51:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BA1546FC82 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1636674698; bh=R+tceoE6MfZEvmO+ls45ln1vVYw76weZN6WBheMm8SE=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YGnsF3HgfCFZdto+5QRVvu/heVHmAY3g4VjdH1t3/x8p0+gRQbCxxlA+vxESLcBDL J+yB9XmEsU+6g0JXsskeTlyW3TXolnn7N3poFkFMOx50BYXVM5GRVM+sbANSPWak7z hVW2uKtm8cNr1OEdLN2eX7ze1tjxMImUL5AoxK24= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 14E9B6FFBB for ; Fri, 12 Nov 2021 02:51:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 14E9B6FFBB Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mlJqU-0005Fw-W6; Fri, 12 Nov 2021 02:51:07 +0300 Message-ID: <2d0c8543-7191-0e62-cce0-98e35b07cade@tarantool.org> Date: Fri, 12 Nov 2021 00:51:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 To: Serge Petrenko , tarantool-patches@dev.tarantool.org, vdavydov@tarantool.org References: <9a8c5c8c3466f6d00a76e7b4e24921b4d4e1286f.1636156453.git.v.shpilevoy@tarantool.org> <03971784-b1d0-1366-f03b-2e10fce807f6@tarantool.org> Content-Language: en-US In-Reply-To: <03971784-b1d0-1366-f03b-2e10fce807f6@tarantool.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9731B3922EC063979B1F6335FDD7DA46529643274CFE4D7E800894C459B0CD1B9732E863597F061986EE7E6D19CBA113C7F76FE7EF67E38FFA938C1B4F21A4609 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B9FBA884A7C9B8BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637040380BD28C1B15C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8BA21AE18EFE5E4880422958DDDF0CFDC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCECADA55FE5B58BB7A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6300D3B61E77C8D3B089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B50537BF44C8E1EC058AE5EEF7D78970594E X-C1DE0DAB: 0D63561A33F958A5CAA345FA05CFF375ADE05AE1E4F91D7D661572AC13B2484BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA754E2A133C74F7AB4F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346C409ABC5F9C579B1C364C29404E177C6E4D19DBB56312533A26952EC7C8FCB00BA9938102EE15BF1D7E09C32AA3244CEE3DEE6C013B70E329B1077F3E1A493FCE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4t8MBgWr8bKd4TaDt2N1/w== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DDB6B4CAC62BDEBE65A616C5747169BD03841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 8/9] luatest: add new helpers for 'server' object X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the review! >> diff --git a/test/luatest_helpers/server.lua b/test/luatest_helpers/server.lua >> index b6d6f1400..9959bca6c 100644 >> --- a/test/luatest_helpers/server.lua >> +++ b/test/luatest_helpers/server.lua >> @@ -75,28 +75,45 @@ function Server:build_env() >>       return res >>   end >>   -function Server:wait_for_readiness() >> -    local alias = self.alias >> -    local id = self.id >> -    local pid = self.process.pid >> +local function wait_cond(cond_name, server, func, ...) >> +    local alias = server.alias >> +    local id = server.id >> +    local pid = server.process.pid >>         local deadline = clock.time() + WAIT_TIMEOUT >>       while true do >> -        local ok, is_ready = pcall(function() >> -            self:connect_net_box() >> -            return self.net_box:eval('return _G.ready') == true >> -        end) >> -        if ok and is_ready then >> -            break >> +        if func(...) then >> +            return >>           end >>           if clock.time() > deadline then >> -            error(('Starting of server %s-%s (PID %d) was timed out'):format( >> -                alias, id, pid)) >> +            error(('Waiting for "%s" on server %s-%s (PID %d) timed out') >> +                  :format(alias, id, pid)) > > 1. Looks like you forgot to use "cond_name" in the error message. ==================== Yes indeed, thanks for noticing: error(('Waiting for "%s" on server %s-%s (PID %d) timed out') - :format(alias, id, pid)) + :format(cond_name, alias, id, pid)) end ==================== >> @@ -116,6 +133,29 @@ function Server:start(opts) >>       end >>   end >>   +function Server:instance_id() >> +    -- Cache the value when found it first time. >> +    if self.instance_id_value then >> +        return self.instance_id_value >> +    end >> +    local id = self:exec(function() return box.info.id end) >> +    -- But do not cache 0 - it is an anon instance, its ID might change. >> +    if id ~= 0 then >> +        self.instance_id_value = id >> +    end >> +    return id >> +end > > 2. Let's reset cached instance id in Server:cleanup(). >    One might want to call Server:cleanup() and then restart the server >    making it receive a new instance id. Thanks, done: ==================== @@ -186,6 +186,8 @@ function Server:cleanup() for _, pattern in ipairs(DEFAULT_CHECKPOINT_PATTERNS) do fio.rmtree(('%s/%s'):format(self.workdir, pattern)) end + self.instance_id_value = nil + self.instance_uuid_value = nil end ====================