Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1] test: fix flaky replication/status.test.lua
@ 2020-06-09 14:16 Alexander V. Tikhonov
  2020-06-09 16:10 ` Sergey Bronnikov
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander V. Tikhonov @ 2020-06-09 14:16 UTC (permalink / raw)
  To: Oleg Piskunov, Sergey Bronnikov; +Cc: tarantool-patches, Alexander Turenko

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

 test/replication/status.test.lua | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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: <number>'")
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH v1] test: fix flaky replication/status.test.lua
  2020-06-09 14:16 [Tarantool-patches] [PATCH v1] test: fix flaky replication/status.test.lua Alexander V. Tikhonov
@ 2020-06-09 16:10 ` Sergey Bronnikov
  2020-06-09 16:31   ` Alexander V. Tikhonov
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Bronnikov @ 2020-06-09 16:10 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: Oleg Piskunov, tarantool-patches, Alexander Turenko

Hi, Sasha

test doesn't work for me at all - failed 5 out of 5 times:

[001] Test failed! Result content mismatch:
[001] --- replication/status.result     Tue Apr 28 07:45:20 2020
[001] +++ replication/status.reject     Tue Jun  9 16:02:09 2020
[001] @@ -302,14 +302,7 @@
[001]  ---                                                                                                                                        [001]  - true
[001]  ...
[001] -r = box.info.replication[1]
[001] ----
[001] -...
[001] -r.upstream.status == "stopped"
[001] ----
[001] -- true                                                                                                                                     [001] -...
[001] -r.upstream.message:match('Duplicate') ~= nil
[001] +test_run:wait_upstream(1, {status = 'stopped', message_re = 'Duplicate'})
[001]  ---
[001]  - true
[001]  ...
[001]

Sergey

On 17:16 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
> 
>  test/replication/status.test.lua | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> 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: <number>'")
> -- 
> 2.17.1
> 

-- 
sergeyb@

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH v1] test: fix flaky replication/status.test.lua
  2020-06-09 16:10 ` Sergey Bronnikov
@ 2020-06-09 16:31   ` Alexander V. Tikhonov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander V. Tikhonov @ 2020-06-09 16:31 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches

Hi Sergey, thanks a lot for the review, forgot to add to the patch
the result file. I'll resend it with the new review letter.

On Tue, Jun 09, 2020 at 07:10:41PM +0300, Sergey Bronnikov wrote:
> Hi, Sasha
> 
> test doesn't work for me at all - failed 5 out of 5 times:
> 
> [001] Test failed! Result content mismatch:
> [001] --- replication/status.result     Tue Apr 28 07:45:20 2020
> [001] +++ replication/status.reject     Tue Jun  9 16:02:09 2020
> [001] @@ -302,14 +302,7 @@
> [001]  ---                                                                                                                                        [001]  - true
> [001]  ...
> [001] -r = box.info.replication[1]
> [001] ----
> [001] -...
> [001] -r.upstream.status == "stopped"
> [001] ----
> [001] -- true                                                                                                                                     [001] -...
> [001] -r.upstream.message:match('Duplicate') ~= nil
> [001] +test_run:wait_upstream(1, {status = 'stopped', message_re = 'Duplicate'})
> [001]  ---
> [001]  - true
> [001]  ...
> [001]
> 
> Sergey
> 
> On 17:16 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
> > 
> >  test/replication/status.test.lua | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > 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: <number>'")
> > -- 
> > 2.17.1
> > 
> 
> -- 
> sergeyb@

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-09 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 14:16 [Tarantool-patches] [PATCH v1] test: fix flaky replication/status.test.lua Alexander V. Tikhonov
2020-06-09 16:10 ` Sergey Bronnikov
2020-06-09 16:31   ` Alexander V. Tikhonov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox