Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v3] test: need to wait for upstream/downstream status
@ 2019-04-16 17:35 avtikhon
  2019-05-10 17:44 ` [tarantool-patches] " Alexander Turenko
  0 siblings, 1 reply; 2+ messages in thread
From: avtikhon @ 2019-04-16 17:35 UTC (permalink / raw)
  To: alexander.turenko; +Cc: avtikhon, tarantool-patches

It is needed to wait for upstream/downstream status, otherwise
error occurs:

    [025] --- replication/show_error_on_disconnect.result Fri Apr 12 14:49:26 2019
    [025] +++ replication/show_error_on_disconnect.reject Tue Apr 16 07:35:41 2019
    [025] @@ -77,11 +77,12 @@
    [025] ...
    [025] box.info.replication[other_id].upstream.status
    [025] ---
    [025] -- stopped
    [025] +- sync
    [025] ...
    [025] box.info.replication[other_id].upstream.message:match("Missing")
    [025] ---
    [025] -- Missing
    [025] +- error: '[string "return box.info.replication[other_id].upstrea..."]:1: attempt to
    [025] + index field ''message'' (a nil value)'
    [025] ...
    [025] test_run:cmd("switch master_quorum2")
    [025] ---
    [025]

Close #4161
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4161-show_error_on_disconnect-test
Issue: https://github.com/tarantool/tarantool/issues/4161

 .../show_error_on_disconnect.result           | 24 +++++--------------
 .../show_error_on_disconnect.test.lua         |  9 +++----
 2 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/test/replication/show_error_on_disconnect.result b/test/replication/show_error_on_disconnect.result
index af082203b..662bf1ea7 100644
--- a/test/replication/show_error_on_disconnect.result
+++ b/test/replication/show_error_on_disconnect.result
@@ -75,13 +75,9 @@ box.space.test:select()
 other_id = box.info.id % 2 + 1
 ---
 ...
-box.info.replication[other_id].upstream.status
+test_run:wait_upstream(other_id, 'stopped', 'Missing')
 ---
-- stopped
-...
-box.info.replication[other_id].upstream.message:match("Missing")
----
-- Missing
+- true
 ...
 test_run:cmd("switch master_quorum2")
 ---
@@ -96,21 +92,13 @@ box.space.test:select()
 other_id = box.info.id % 2 + 1
 ---
 ...
-box.info.replication[other_id].upstream.status
----
-- follow
-...
-box.info.replication[other_id].upstream.message
+test_run:wait_upstream(other_id, 'follow', box.NULL)
 ---
-- null
-...
-box.info.replication[other_id].downstream.status
----
-- stopped
+- true
 ...
-box.info.replication[other_id].downstream.message:match("Missing")
+test_run:wait_downstream(other_id, 'stopped', 'Missing')
 ---
-- Missing
+- true
 ...
 test_run:cmd("switch default")
 ---
diff --git a/test/replication/show_error_on_disconnect.test.lua b/test/replication/show_error_on_disconnect.test.lua
index 40e9dbc5e..10457e11c 100644
--- a/test/replication/show_error_on_disconnect.test.lua
+++ b/test/replication/show_error_on_disconnect.test.lua
@@ -30,15 +30,12 @@ box.cfg{replication = repl}
 require('fiber').sleep(0.1)
 box.space.test:select()
 other_id = box.info.id % 2 + 1
-box.info.replication[other_id].upstream.status
-box.info.replication[other_id].upstream.message:match("Missing")
+test_run:wait_upstream(other_id, 'stopped', 'Missing')
 test_run:cmd("switch master_quorum2")
 box.space.test:select()
 other_id = box.info.id % 2 + 1
-box.info.replication[other_id].upstream.status
-box.info.replication[other_id].upstream.message
-box.info.replication[other_id].downstream.status
-box.info.replication[other_id].downstream.message:match("Missing")
+test_run:wait_upstream(other_id, 'follow', box.NULL)
+test_run:wait_downstream(other_id, 'stopped', 'Missing')
 test_run:cmd("switch default")
 -- Cleanup.
 test_run:drop_cluster(SERVERS)
-- 
2.17.1

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

* [tarantool-patches] Re: [PATCH v3] test: need to wait for upstream/downstream status
  2019-04-16 17:35 [tarantool-patches] [PATCH v3] test: need to wait for upstream/downstream status avtikhon
@ 2019-05-10 17:44 ` Alexander Turenko
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Turenko @ 2019-05-10 17:44 UTC (permalink / raw)
  To: avtikhon; +Cc: tarantool-patches

It worth to remove fiber.sleep() before the status / message checks.

I also have updated the API in
https://github.com/tarantool/test-run/pull/163 to make it extensible. So
now status / message checks looks so:

 | test_run:wait_upstream(other_id, {status = 'stopped', message_re = 'Missing'})
 | test_run:wait_upstream(other_id, {status = 'follow', message_re = box.NULL})

Aside that the patch looks good for me.

Pushed to master and 2.1.

WBR, Alexander Turenko.

On Tue, Apr 16, 2019 at 08:35:27PM +0300, avtikhon wrote:
> It is needed to wait for upstream/downstream status, otherwise
> error occurs:
> 
>     [025] --- replication/show_error_on_disconnect.result Fri Apr 12 14:49:26 2019
>     [025] +++ replication/show_error_on_disconnect.reject Tue Apr 16 07:35:41 2019
>     [025] @@ -77,11 +77,12 @@
>     [025] ...
>     [025] box.info.replication[other_id].upstream.status
>     [025] ---
>     [025] -- stopped
>     [025] +- sync
>     [025] ...
>     [025] box.info.replication[other_id].upstream.message:match("Missing")
>     [025] ---
>     [025] -- Missing
>     [025] +- error: '[string "return box.info.replication[other_id].upstrea..."]:1: attempt to
>     [025] + index field ''message'' (a nil value)'
>     [025] ...
>     [025] test_run:cmd("switch master_quorum2")
>     [025] ---
>     [025]
> 
> Close #4161
> ---
> 
> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4161-show_error_on_disconnect-test
> Issue: https://github.com/tarantool/tarantool/issues/4161
> 
>  .../show_error_on_disconnect.result           | 24 +++++--------------
>  .../show_error_on_disconnect.test.lua         |  9 +++----
>  2 files changed, 9 insertions(+), 24 deletions(-)
> 
> diff --git a/test/replication/show_error_on_disconnect.result b/test/replication/show_error_on_disconnect.result
> index af082203b..662bf1ea7 100644
> --- a/test/replication/show_error_on_disconnect.result
> +++ b/test/replication/show_error_on_disconnect.result
> @@ -75,13 +75,9 @@ box.space.test:select()
>  other_id = box.info.id % 2 + 1
>  ---
>  ...
> -box.info.replication[other_id].upstream.status
> +test_run:wait_upstream(other_id, 'stopped', 'Missing')
>  ---
> -- stopped
> -...
> -box.info.replication[other_id].upstream.message:match("Missing")
> ----
> -- Missing
> +- true
>  ...
>  test_run:cmd("switch master_quorum2")
>  ---
> @@ -96,21 +92,13 @@ box.space.test:select()
>  other_id = box.info.id % 2 + 1
>  ---
>  ...
> -box.info.replication[other_id].upstream.status
> ----
> -- follow
> -...
> -box.info.replication[other_id].upstream.message
> +test_run:wait_upstream(other_id, 'follow', box.NULL)
>  ---
> -- null
> -...
> -box.info.replication[other_id].downstream.status
> ----
> -- stopped
> +- true
>  ...
> -box.info.replication[other_id].downstream.message:match("Missing")
> +test_run:wait_downstream(other_id, 'stopped', 'Missing')
>  ---
> -- Missing
> +- true
>  ...
>  test_run:cmd("switch default")
>  ---
> diff --git a/test/replication/show_error_on_disconnect.test.lua b/test/replication/show_error_on_disconnect.test.lua
> index 40e9dbc5e..10457e11c 100644
> --- a/test/replication/show_error_on_disconnect.test.lua
> +++ b/test/replication/show_error_on_disconnect.test.lua
> @@ -30,15 +30,12 @@ box.cfg{replication = repl}
>  require('fiber').sleep(0.1)
>  box.space.test:select()
>  other_id = box.info.id % 2 + 1
> -box.info.replication[other_id].upstream.status
> -box.info.replication[other_id].upstream.message:match("Missing")
> +test_run:wait_upstream(other_id, 'stopped', 'Missing')
>  test_run:cmd("switch master_quorum2")
>  box.space.test:select()
>  other_id = box.info.id % 2 + 1
> -box.info.replication[other_id].upstream.status
> -box.info.replication[other_id].upstream.message
> -box.info.replication[other_id].downstream.status
> -box.info.replication[other_id].downstream.message:match("Missing")
> +test_run:wait_upstream(other_id, 'follow', box.NULL)
> +test_run:wait_downstream(other_id, 'stopped', 'Missing')
>  test_run:cmd("switch default")
>  -- Cleanup.
>  test_run:drop_cluster(SERVERS)
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2019-05-10 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 17:35 [tarantool-patches] [PATCH v3] test: need to wait for upstream/downstream status avtikhon
2019-05-10 17:44 ` [tarantool-patches] " Alexander Turenko

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