From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (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 D958E469710 for ; Tue, 9 Jun 2020 22:22:49 +0300 (MSK) Date: Tue, 9 Jun 2020 22:21:38 +0300 From: Sergey Bronnikov Message-ID: <20200609192138.GF67772@pony.bronevichok.ru> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH v2] test: fix flaky replication/status.test.lua List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Alexander V. Tikhonov" Cc: Oleg Piskunov , tarantool-patches@dev.tarantool.org, Alexander Turenko Hi, Sasha thanks for the patch! LGTM On 19:34 Tue 09 Jun , Alexander V. Tikhonov wrote: > Found issue: > > [009] --- replication/status.result Wed May 6 09:03:18 2020 > [009] +++ replication/status.reject Tue May 12 15:55:09 2020 > [009] @@ -307,11 +307,12 @@ > [009] ... > [009] r.upstream.status == "stopped" > [009] --- > [009] -- true > [009] +- false > [009] ... > [009] r.upstream.message:match('Duplicate') ~= nil > [009] --- > [009] -- true > [009] +- error: '[string "return r.upstream.message:match(''Duplicate'') ..."]:1: attempt > [009] + to index field ''message'' (a nil value)' > [009] ... > [009] test_run:cmd('switch default') > [009] --- > > To check the upstream status and it's message need to wait until an > upstream appears. This prevents an attempt to index a nil value when > one of those functions are called before a record about a peer appears > in box.info.replication. It was observed on test: > replication/show_error_on_disconnect > after commit > c6bea65f8ef5f6c737cf70c0127189d0ebcbc36e ('replication: recfg with 0 > quorum returns immediately'). > > Closes #4969 > --- > > Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4969-replication-status > Issue: https://github.com/tarantool/tarantool/issues/4969 > > V1: Forgot to commit result file. > > test/replication/status.result | 9 +-------- > test/replication/status.test.lua | 4 +--- > 2 files changed, 2 insertions(+), 11 deletions(-) > > diff --git a/test/replication/status.result b/test/replication/status.result > index a1e51e435..a86f48774 100644 > --- a/test/replication/status.result > +++ b/test/replication/status.result > @@ -302,14 +302,7 @@ test_run:cmd('switch replica') > --- > - true > ... > -r = box.info.replication[1] > ---- > -... > -r.upstream.status == "stopped" > ---- > -- true > -... > -r.upstream.message:match('Duplicate') ~= nil > +test_run:wait_upstream(1, {status = 'stopped', message_re = 'Duplicate'}) > --- > - true > ... > diff --git a/test/replication/status.test.lua b/test/replication/status.test.lua > index a26fec74b..090968172 100644 > --- a/test/replication/status.test.lua > +++ b/test/replication/status.test.lua > @@ -110,9 +110,7 @@ box.space._schema:insert({'dup'}) > test_run:cmd('switch default') > box.space._schema:insert({'dup'}) > test_run:cmd('switch replica') > -r = box.info.replication[1] > -r.upstream.status == "stopped" > -r.upstream.message:match('Duplicate') ~= nil > +test_run:wait_upstream(1, {status = 'stopped', message_re = 'Duplicate'}) > test_run:cmd('switch default') > box.space._schema:delete({'dup'}) > test_run:cmd("push filter ', lsn: [0-9]+' to ', lsn: '") > -- > 2.17.1 >