From: Sergei Voronezhskii <sergw@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: [PATCH v2 4/5] test: use wait_cond to check follow status
Date: Fri, 19 Oct 2018 19:17:20 +0300 [thread overview]
Message-ID: <20181019161721.49560-5-sergw@tarantool.org> (raw)
In-Reply-To: <20181019161721.49560-1-sergw@tarantool.org>
If `test_run:wait_cond()` found a not 'follow` status it returns true.
Which immediately causes an error.
Fixes #3734
Part of #2436, #3232
---
test/replication/misc.result | 17 +++++++++++------
test/replication/misc.test.lua | 15 +++++++++------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/test/replication/misc.result b/test/replication/misc.result
index 02f4d47f4..58e512c30 100644
--- a/test/replication/misc.result
+++ b/test/replication/misc.result
@@ -146,15 +146,20 @@ test_run:cmd("setopt delimiter ';'")
---
- true
...
+function wait_follow(replicaA, replicaB)
+ return test_run:wait_cond(function()
+ return replicaA.status ~= 'follow' or replicaB.status ~= 'follow'
+ end, 0.01)
+end ;
+---
+...
function test_timeout()
for i = 0, 99 do
+ local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream
+ local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream
box.space.test_timeout:replace({1})
- fiber.sleep(0.005)
- local rinfo = box.info.replication
- if rinfo[1].upstream and rinfo[1].upstream.status ~= 'follow' or
- rinfo[2].upstream and rinfo[2].upstream.status ~= 'follow' or
- rinfo[3].upstream and rinfo[3].upstream.status ~= 'follow' then
- return error('Replication broken')
+ if wait_follow(replicaA, replicaB) then
+ return error(box.info.replication)
end
end
return true
diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua
index 06ad974db..3866eb3ac 100644
--- a/test/replication/misc.test.lua
+++ b/test/replication/misc.test.lua
@@ -53,15 +53,18 @@ fiber=require('fiber')
box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01}
_ = box.schema.space.create('test_timeout'):create_index('pk')
test_run:cmd("setopt delimiter ';'")
+function wait_follow(replicaA, replicaB)
+ return test_run:wait_cond(function()
+ return replicaA.status ~= 'follow' or replicaB.status ~= 'follow'
+ end, 0.01)
+end ;
function test_timeout()
for i = 0, 99 do
+ local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream
+ local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream
box.space.test_timeout:replace({1})
- fiber.sleep(0.005)
- local rinfo = box.info.replication
- if rinfo[1].upstream and rinfo[1].upstream.status ~= 'follow' or
- rinfo[2].upstream and rinfo[2].upstream.status ~= 'follow' or
- rinfo[3].upstream and rinfo[3].upstream.status ~= 'follow' then
- return error('Replication broken')
+ if wait_follow(replicaA, replicaB) then
+ return error(box.info.replication)
end
end
return true
--
2.18.0
next prev parent reply other threads:[~2018-10-19 16:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 16:17 [PATCH v2 0/5] test: replication parallel mode on Sergei Voronezhskii
2018-10-19 16:17 ` [PATCH v2 1/5] test: cleanup replication tests Sergei Voronezhskii
2018-10-21 20:41 ` Alexander Turenko
2018-10-22 8:07 ` Re[2]: " Sergei Voronezhskii
2018-10-23 3:21 ` Alexander Turenko
2018-10-19 16:17 ` [PATCH v2 2/5] test: errinj for pause relay_send Sergei Voronezhskii
2018-10-21 20:41 ` Alexander Turenko
2018-10-22 8:42 ` Re[2]: " Sergei Voronezhskii
2018-10-23 3:22 ` Alexander Turenko
2018-10-19 16:17 ` [PATCH v2 3/5] test: put require in proper places Sergei Voronezhskii
2018-10-21 20:41 ` Alexander Turenko
2018-10-19 16:17 ` Sergei Voronezhskii [this message]
2018-10-19 23:24 ` [PATCH v2 4/5] test: use wait_cond to check follow status Alexander Turenko
2018-10-25 16:43 ` [tarantool-patches] " Sergei Voronezhskii
2018-10-29 10:41 ` Alexander Turenko
2018-10-31 21:38 ` Re[2]: " Sergei Voronezhskii
2018-10-19 16:17 ` [PATCH v2 5/5] test: replication parallel mode on Sergei Voronezhskii
2018-10-19 23:37 ` [PATCH v2 0/5] " Alexander Turenko
2018-10-19 23:44 ` Alexander Turenko
2018-10-26 12:41 ` Re[2]: " Sergei Voronezhskii
2018-10-26 12:44 ` Sergei Voronezhskii
2018-10-30 17:38 ` Re[3]: " Sergei Voronezhskii
2018-10-31 18:28 ` Alexander Turenko
2018-11-26 13:04 ` Re[2]: " Sergei Voronezhskii
2018-12-05 4:44 ` Re[3]: " Sergei Voronezhskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181019161721.49560-5-sergw@tarantool.org \
--to=sergw@tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [PATCH v2 4/5] test: use wait_cond to check follow status' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox