Tarantool development patches archive
 help / color / mirror / Atom feed
From: avtikhon <avtikhon@tarantool.org>
To: Alexander Turenko <alexander.turenko@tarantool.org>
Cc: avtikhon <avtikhon@gmail.com>, tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH v1 2/6] Insert status calls inside wait_cond routines
Date: Mon,  1 Apr 2019 17:13:31 +0300	[thread overview]
Message-ID: <3c1ddecd66058ad9df1164062828d278924b7f46.1554127720.git.avtikhon@gmail.com> (raw)
In-Reply-To: <e8298e8dce4a9de5c53cff304da9c9af294c5434.1554127720.git.avtikhon@gmail.com>
In-Reply-To: <e8298e8dce4a9de5c53cff304da9c9af294c5434.1554127720.git.avtikhon@gmail.com>

From: avtikhon <avtikhon@gmail.com>

---
 test/replication/errinj.result                | 12 ++---
 test/replication/errinj.test.lua              |  8 +--
 test/replication/force_recovery.result        |  4 +-
 test/replication/force_recovery.test.lua      |  4 +-
 test/replication/gc.result                    |  6 +--
 test/replication/gc.test.lua                  |  6 +--
 test/replication/gc_no_space.result           | 18 ++++---
 test/replication/gc_no_space.test.lua         | 18 ++++---
 test/replication/join_vclock.result           |  5 +-
 test/replication/join_vclock.test.lua         |  4 +-
 test/replication/long_row_timeout.result      |  4 +-
 test/replication/long_row_timeout.test.lua    |  3 +-
 test/replication/misc.result                  |  4 +-
 test/replication/misc.test.lua                |  2 +-
 test/replication/quorum.result                | 42 +++++++--------
 test/replication/quorum.test.lua              | 24 ++++-----
 test/replication/rebootstrap.result           |  4 +-
 test/replication/rebootstrap.test.lua         |  2 +-
 test/replication/replica_rejoin.result        | 14 ++---
 test/replication/replica_rejoin.test.lua      | 10 ++--
 .../show_error_on_disconnect.result           | 12 ++---
 .../show_error_on_disconnect.test.lua         |  6 +--
 test/replication/skip_conflict_row.result     | 39 +++++++-------
 test/replication/skip_conflict_row.test.lua   | 21 ++++----
 test/replication/status.result                | 11 +---
 test/replication/status.test.lua              |  6 +--
 test/replication/sync.result                  | 53 +++++++------------
 test/replication/sync.test.lua                | 27 +++++-----
 test/replication/wal_off.result               |  2 +-
 test/replication/wal_off.test.lua             |  2 +-
 test/replication/wal_rw_stress.result         |  2 +-
 test/replication/wal_rw_stress.test.lua       |  2 +-
 32 files changed, 181 insertions(+), 196 deletions(-)

diff --git a/test/replication/errinj.result b/test/replication/errinj.result
index 0f3096704..d4ac85ae8 100644
--- a/test/replication/errinj.result
+++ b/test/replication/errinj.result
@@ -303,11 +303,11 @@ box.info.replication[1].upstream.status
 ---
 - follow
 ...
-box.info.replication[1].upstream.lag > 0
+test_run:wait_cond(function() return box.info.replication[1].upstream.lag > 0 end) or box.info.replication[1].upstream.lag
 ---
 - true
 ...
-box.info.replication[1].upstream.lag < 1
+test_run:wait_cond(function() return box.info.replication[1].upstream.lag < 1 end) or box.info.replication[1].upstream.lag
 ---
 - true
 ...
@@ -485,16 +485,16 @@ fiber = require('fiber')
 while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end
 ---
 ...
-box.info.replication[1].upstream.status -- follow
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 for i = 0, 15 do fiber.sleep(0.01) if box.info.replication[1].upstream.status ~= 'follow' then break end end
 ---
 ...
-box.info.replication[1].upstream.status -- follow
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 test_run:cmd("switch default")
 ---
diff --git a/test/replication/errinj.test.lua b/test/replication/errinj.test.lua
index e9965483e..6522df9d8 100644
--- a/test/replication/errinj.test.lua
+++ b/test/replication/errinj.test.lua
@@ -129,8 +129,8 @@ test_run:cmd("switch replica")
 -- wait for reconnect
 while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end
 box.info.replication[1].upstream.status
-box.info.replication[1].upstream.lag > 0
-box.info.replication[1].upstream.lag < 1
+test_run:wait_cond(function() return box.info.replication[1].upstream.lag > 0 end) or box.info.replication[1].upstream.lag
+test_run:wait_cond(function() return box.info.replication[1].upstream.lag < 1 end) or box.info.replication[1].upstream.lag
 -- wait for ack timeout
 while box.info.replication[1].upstream.message ~= 'timed out' do fiber.sleep(0.0001) end
 
@@ -203,9 +203,9 @@ test_run:cmd("switch replica_timeout")
 
 fiber = require('fiber')
 while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end
-box.info.replication[1].upstream.status -- follow
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 for i = 0, 15 do fiber.sleep(0.01) if box.info.replication[1].upstream.status ~= 'follow' then break end end
-box.info.replication[1].upstream.status -- follow
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 
 test_run:cmd("switch default")
 test_run:cmd("stop server replica_timeout")
diff --git a/test/replication/force_recovery.result b/test/replication/force_recovery.result
index 7d1beea47..d3539e7c8 100644
--- a/test/replication/force_recovery.result
+++ b/test/replication/force_recovery.result
@@ -30,7 +30,7 @@ test_run:cmd("stop server test")
 ---
 - true
 ...
-test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end)
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status
 ---
 - true
 ...
@@ -75,7 +75,7 @@ box.space.test:select()
 ---
 - []
 ...
-box.info.replication[1].upstream.status == 'stopped' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info
 ---
 - true
 ...
diff --git a/test/replication/force_recovery.test.lua b/test/replication/force_recovery.test.lua
index 9ac5dadf5..7669d7f22 100644
--- a/test/replication/force_recovery.test.lua
+++ b/test/replication/force_recovery.test.lua
@@ -14,7 +14,7 @@ test_run:cmd("start server test")
 
 -- Stop the replica and wait for the relay thread to exit.
 test_run:cmd("stop server test")
-test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end)
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status
 
 -- Delete an xlog file that is needed by the replica.
 box.snapshot()
@@ -30,7 +30,7 @@ box.cfg{force_recovery = true}
 test_run:cmd("start server test")
 test_run:cmd("switch test")
 box.space.test:select()
-box.info.replication[1].upstream.status == 'stopped' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info
 test_run:cmd("switch default")
 box.cfg{force_recovery = false}
 
diff --git a/test/replication/gc.result b/test/replication/gc.result
index ccf11fe8e..950697112 100644
--- a/test/replication/gc.result
+++ b/test/replication/gc.result
@@ -117,7 +117,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-test_run:wait_cond(function() return box.space.test:count() == 200 end)
+test_run:wait_cond(function() return box.space.test:count() == 200 end) or box.space.test:count()
 ---
 - true
 ...
@@ -187,7 +187,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-test_run:wait_cond(function() return box.space.test:count() == 300 end)
+test_run:wait_cond(function() return box.space.test:count() == 300 end) or box.space.test:count()
 ---
 - true
 ...
@@ -271,7 +271,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-test_run:wait_cond(function() return box.space.test:count() == 310 end)
+test_run:wait_cond(function() return box.space.test:count() == 310 end) or box.space.test:count()
 ---
 - true
 ...
diff --git a/test/replication/gc.test.lua b/test/replication/gc.test.lua
index 64e9d82fe..d9c6960fd 100644
--- a/test/replication/gc.test.lua
+++ b/test/replication/gc.test.lua
@@ -63,7 +63,7 @@ test_run:cmd("start server replica")
 -- bootstrapped from, the replica should still receive all
 -- data from the master. Check it.
 test_run:cmd("switch replica")
-test_run:wait_cond(function() return box.space.test:count() == 200 end)
+test_run:wait_cond(function() return box.space.test:count() == 200 end) or box.space.test:count()
 box.space.test:count()
 test_run:cmd("switch default")
 
@@ -95,7 +95,7 @@ box.error.injection.set("ERRINJ_RELAY_SEND_DELAY", false)
 
 -- Check that the replica received all data from the master.
 test_run:cmd("switch replica")
-test_run:wait_cond(function() return box.space.test:count() == 300 end)
+test_run:wait_cond(function() return box.space.test:count() == 300 end) or box.space.test:count()
 box.space.test:count()
 test_run:cmd("switch default")
 
@@ -130,7 +130,7 @@ box.cfg{replication = {}}
 test_run:cmd("restart server replica")
 -- Wait for the replica to catch up.
 test_run:cmd("switch replica")
-test_run:wait_cond(function() return box.space.test:count() == 310 end)
+test_run:wait_cond(function() return box.space.test:count() == 310 end) or box.space.test:count()
 box.space.test:count()
 test_run:cmd("switch default")
 -- Now it's safe to drop the old xlog.
diff --git a/test/replication/gc_no_space.result b/test/replication/gc_no_space.result
index b2d3e2075..e860ab00f 100644
--- a/test/replication/gc_no_space.result
+++ b/test/replication/gc_no_space.result
@@ -20,22 +20,24 @@ test_run:cmd("setopt delimiter ';'")
 ---
 - true
 ...
-function check_file_count(dir, glob, count)
-    local files = fio.glob(fio.pathjoin(dir, glob))
-    if #files == count then
-        return true
-    end
-    return false, files
+function wait_file_count(dir, glob, count)
+    return test_run:wait_cond(function()
+        local files = fio.glob(fio.pathjoin(dir, glob))
+        if #files == count then
+            return true
+        end
+        return false, files
+    end)
 end;
 ---
 ...
 function check_wal_count(count)
-    return check_file_count(box.cfg.wal_dir, '*.xlog', count)
+    return wait_file_count(box.cfg.wal_dir, '*.xlog', count)
 end;
 ---
 ...
 function check_snap_count(count)
-    return check_file_count(box.cfg.memtx_dir, '*.snap', count)
+    return wait_file_count(box.cfg.memtx_dir, '*.snap', count)
 end;
 ---
 ...
diff --git a/test/replication/gc_no_space.test.lua b/test/replication/gc_no_space.test.lua
index 6940996fe..98ccd401b 100644
--- a/test/replication/gc_no_space.test.lua
+++ b/test/replication/gc_no_space.test.lua
@@ -11,18 +11,20 @@ fio = require('fio')
 errinj = box.error.injection
 
 test_run:cmd("setopt delimiter ';'")
-function check_file_count(dir, glob, count)
-    local files = fio.glob(fio.pathjoin(dir, glob))
-    if #files == count then
-        return true
-    end
-    return false, files
+function wait_file_count(dir, glob, count)
+    return test_run:wait_cond(function()
+        local files = fio.glob(fio.pathjoin(dir, glob))
+        if #files == count then
+            return true
+        end
+        return false, files
+    end)
 end;
 function check_wal_count(count)
-    return check_file_count(box.cfg.wal_dir, '*.xlog', count)
+    return wait_file_count(box.cfg.wal_dir, '*.xlog', count)
 end;
 function check_snap_count(count)
-    return check_file_count(box.cfg.memtx_dir, '*.snap', count)
+    return wait_file_count(box.cfg.memtx_dir, '*.snap', count)
 end;
 test_run:cmd("setopt delimiter ''");
 
diff --git a/test/replication/join_vclock.result b/test/replication/join_vclock.result
index a9781073d..d5abeb750 100644
--- a/test/replication/join_vclock.result
+++ b/test/replication/join_vclock.result
@@ -67,10 +67,11 @@ test_run:cmd("switch replica1")
 ---
 - true
 ...
-cnt = box.space.test.index[0]:count()
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
+- true
 ...
-box.space.test.index.primary:max()[1] == cnt - 1
+test_run:wait_cond(function() return box.space.test.index.primary:max()[1] == box.space.test.index[0]:count() - 1 end) or box.space.test.index[0]:count()
 ---
 - true
 ...
diff --git a/test/replication/join_vclock.test.lua b/test/replication/join_vclock.test.lua
index 0b60dffc2..2a06739c2 100644
--- a/test/replication/join_vclock.test.lua
+++ b/test/replication/join_vclock.test.lua
@@ -26,8 +26,8 @@ ch:get()
 
 errinj.set("ERRINJ_RELAY_FINAL_SLEEP", false)
 test_run:cmd("switch replica1")
-cnt = box.space.test.index[0]:count()
-box.space.test.index.primary:max()[1] == cnt - 1
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.space.test.index.primary:max()[1] == box.space.test.index[0]:count() - 1 end) or box.space.test.index[0]:count()
 test_run:cmd("switch default")
 
 replica_set.drop_all(test_run)
diff --git a/test/replication/long_row_timeout.result b/test/replication/long_row_timeout.result
index 9284d9c2a..a9567f2c4 100644
--- a/test/replication/long_row_timeout.result
+++ b/test/replication/long_row_timeout.result
@@ -21,9 +21,9 @@ test_run:cmd('start server replica')
 ---
 - true
 ...
-box.info.replication[2].downstream.status
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'follow' end) or box.info.replication[2].downstream.status
 ---
-- follow
+- true
 ...
 -- make applier incapable of reading rows in one go, so that it
 -- yields a couple of times.
diff --git a/test/replication/long_row_timeout.test.lua b/test/replication/long_row_timeout.test.lua
index 7fc52e3e2..cfd9b93dc 100644
--- a/test/replication/long_row_timeout.test.lua
+++ b/test/replication/long_row_timeout.test.lua
@@ -8,8 +8,7 @@ test_run = require('test_run').new()
 box.schema.user.grant('guest', 'replication')
 test_run:cmd('create server replica with rpl_master=default, script="replication/replica.lua"')
 test_run:cmd('start server replica')
-box.info.replication[2].downstream.status
-
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'follow' end) or box.info.replication[2].downstream.status
 
 -- make applier incapable of reading rows in one go, so that it
 -- yields a couple of times.
diff --git a/test/replication/misc.result b/test/replication/misc.result
index ab827c501..f32bbd531 100644
--- a/test/replication/misc.result
+++ b/test/replication/misc.result
@@ -643,9 +643,9 @@ test_run:wait_log("replica", "REPLICASET_UUID_MISMATCH", nil, 1.0)
 ---
 - REPLICASET_UUID_MISMATCH
 ...
-box.info.replication[2].downstream.status
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status
 ---
-- stopped
+- true
 ...
 test_run:cmd("stop server replica")
 ---
diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua
index eda5310b6..ee4584333 100644
--- a/test/replication/misc.test.lua
+++ b/test/replication/misc.test.lua
@@ -258,7 +258,7 @@ _ = box.space._schema:replace{'cluster', tostring(uuid.new())}
 -- master believes replica is in cluster, but their cluster UUIDs differ.
 test_run:cmd("start server replica")
 test_run:wait_log("replica", "REPLICASET_UUID_MISMATCH", nil, 1.0)
-box.info.replication[2].downstream.status
+test_run:wait_cond(function() return box.info.replication[2].downstream.status == 'stopped' end) or box.info.replication[2].downstream.status
 
 test_run:cmd("stop server replica")
 test_run:cmd("cleanup server replica")
diff --git a/test/replication/quorum.result b/test/replication/quorum.result
index 4ad7483b1..09bfbc7ec 100644
--- a/test/replication/quorum.result
+++ b/test/replication/quorum.result
@@ -28,9 +28,9 @@ test_run:cmd('switch quorum2')
 - true
 ...
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 ---
-- orphan
+- true
 ...
 box.ctl.wait_rw(0.001) -- timeout
 ---
@@ -47,14 +47,14 @@ box.space.test:replace{100} -- error
 box.cfg{replication={}}
 ---
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 ---
-- orphan
+- true
 ...
 box.ctl.wait_rw(0.001) -- timeout
 ---
@@ -78,14 +78,14 @@ box.info.ro -- false
 ---
 - false
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 ---
-- orphan
+- true
 ...
 box.ctl.wait_rw(0.001) -- timeout
 ---
@@ -110,20 +110,20 @@ box.info.ro -- false
 ---
 - false
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 -- Check that the replica follows all masters.
-box.info.id == 1 or box.info.replication[1].upstream.status == 'follow'
+test_run:wait_cond(function() return box.info.id == 1 or box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
 - true
 ...
-box.info.id == 2 or box.info.replication[2].upstream.status == 'follow'
+test_run:wait_cond(function() return box.info.id == 2 or box.info.replication[2].upstream.status == 'follow' end) or box.info.replication[2].upstream.status
 ---
 - true
 ...
-box.info.id == 3 or box.info.replication[3].upstream.status == 'follow'
+test_run:wait_cond(function() return box.info.id == 3 or box.info.replication[3].upstream.status == 'follow' end) or box.info.replication[3].upstream.status
 ---
 - true
 ...
@@ -268,9 +268,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 box.space.test:select()
 ---
@@ -298,9 +298,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 test_run:cmd("switch default")
 ---
@@ -324,9 +324,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 box.space.test:select()
 ---
diff --git a/test/replication/quorum.test.lua b/test/replication/quorum.test.lua
index 777f8ef7c..d67bf0f73 100644
--- a/test/replication/quorum.test.lua
+++ b/test/replication/quorum.test.lua
@@ -19,37 +19,37 @@ test_run:cmd('stop server quorum1')
 test_run:cmd('switch quorum2')
 
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 box.ctl.wait_rw(0.001) -- timeout
 box.info.ro -- true
 box.space.test:replace{100} -- error
 box.cfg{replication={}}
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 box.ctl.wait_rw(0.001) -- timeout
 box.info.ro -- true
 box.space.test:replace{100} -- error
 box.cfg{replication_connect_quorum = 2}
 box.ctl.wait_rw()
 box.info.ro -- false
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 test_run:cmd('restart server quorum2 with args="0.1 0.5"')
-box.info.status -- orphan
+test_run:wait_cond(function() return box.info.status == 'orphan' end) or box.info.status
 box.ctl.wait_rw(0.001) -- timeout
 box.info.ro -- true
 box.space.test:replace{100} -- error
 test_run:cmd('start server quorum1 with args="0.1 0.5"')
 box.ctl.wait_rw()
 box.info.ro -- false
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 -- Check that the replica follows all masters.
-box.info.id == 1 or box.info.replication[1].upstream.status == 'follow'
-box.info.id == 2 or box.info.replication[2].upstream.status == 'follow'
-box.info.id == 3 or box.info.replication[3].upstream.status == 'follow'
+test_run:wait_cond(function() return box.info.id == 1 or box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.id == 2 or box.info.replication[2].upstream.status == 'follow' end) or box.info.replication[2].upstream.status
+test_run:wait_cond(function() return box.info.id == 3 or box.info.replication[3].upstream.status == 'follow' end) or box.info.replication[3].upstream.status
 
 -- Check that box.cfg() doesn't return until the instance
 -- catches up with all configured replicas.
@@ -110,7 +110,7 @@ space:insert{1}
 test_run:cmd("create server replica with rpl_master=default, script='replication/replica_no_quorum.lua'")
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 box.space.test:select()
 test_run:cmd("switch default")
 test_run:cmd("stop server replica")
@@ -118,7 +118,7 @@ listen = box.cfg.listen
 box.cfg{listen = ''}
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 test_run:cmd("switch default")
 -- Check that replica is able to reconnect, case was broken with earlier quorum "fix".
 box.cfg{listen = listen}
@@ -126,7 +126,7 @@ space:insert{2}
 vclock = test_run:get_vclock("default")
 _ = test_run:wait_vclock("replica", vclock)
 test_run:cmd("switch replica")
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 box.space.test:select()
 test_run:cmd("switch default")
 test_run:cmd("stop server replica")
diff --git a/test/replication/rebootstrap.result b/test/replication/rebootstrap.result
index 10952408b..3f27f29d6 100644
--- a/test/replication/rebootstrap.result
+++ b/test/replication/rebootstrap.result
@@ -32,9 +32,9 @@ test_run:cmd('switch rebootstrap1')
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 test_run:cmd('switch default')
 ---
diff --git a/test/replication/rebootstrap.test.lua b/test/replication/rebootstrap.test.lua
index afd5108e2..d38d165bd 100644
--- a/test/replication/rebootstrap.test.lua
+++ b/test/replication/rebootstrap.test.lua
@@ -15,7 +15,7 @@ test_run:cmd('stop server rebootstrap1')
 test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1 2.0"')
 test_run:cmd('start server rebootstrap1 with args="0.1"')
 test_run:cmd('switch rebootstrap1')
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 test_run:cmd('switch default')
 test_run:drop_cluster(SERVERS)
diff --git a/test/replication/replica_rejoin.result b/test/replication/replica_rejoin.result
index 87d626e20..9c8c9cf52 100644
--- a/test/replication/replica_rejoin.result
+++ b/test/replication/replica_rejoin.result
@@ -45,7 +45,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.replication[1].upstream.status == 'follow' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
 - true
 ...
@@ -102,9 +102,9 @@ _ = box.space.test:insert{30}
 fio = require('fio')
 ---
 ...
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 ---
-- 1
+- true
 ...
 box.cfg{checkpoint_count = checkpoint_count}
 ---
@@ -123,7 +123,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.replication[1].upstream.status == 'follow' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
 - true
 ...
@@ -203,9 +203,9 @@ for i = 1, 3 do box.space.test:insert{i * 100} end
 fio = require('fio')
 ---
 ...
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 ---
-- 1
+- true
 ...
 box.cfg{checkpoint_count = checkpoint_count}
 ---
@@ -330,7 +330,7 @@ box.cfg{checkpoint_count = default_checkpoint_count}
 fio = require('fio')
 ---
 ...
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 ---
 - true
 ...
diff --git a/test/replication/replica_rejoin.test.lua b/test/replication/replica_rejoin.test.lua
index 9bf43eff8..934aad058 100644
--- a/test/replication/replica_rejoin.test.lua
+++ b/test/replication/replica_rejoin.test.lua
@@ -19,7 +19,7 @@ _ = box.space.test:insert{3}
 test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'")
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
-box.info.replication[1].upstream.status == 'follow' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 box.space.test:select()
 test_run:cmd("switch default")
 test_run:cmd("stop server replica")
@@ -40,7 +40,7 @@ box.snapshot()
 _ = box.space.test:delete{3}
 _ = box.space.test:insert{30}
 fio = require('fio')
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 box.cfg{checkpoint_count = checkpoint_count}
 
 -- Restart the replica. Since xlogs have been removed,
@@ -48,7 +48,7 @@ box.cfg{checkpoint_count = checkpoint_count}
 test_run:cmd("start server replica")
 box.info.replication[2].downstream.vclock ~= nil or box.info
 test_run:cmd("switch replica")
-box.info.replication[1].upstream.status == 'follow' or box.info
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 box.space.test:select()
 test_run:cmd("switch default")
 
@@ -76,7 +76,7 @@ for i = 1, 3 do box.space.test:delete{i * 10} end
 box.snapshot()
 for i = 1, 3 do box.space.test:insert{i * 100} end
 fio = require('fio')
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 box.cfg{checkpoint_count = checkpoint_count}
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
@@ -121,7 +121,7 @@ box.cfg{checkpoint_count = 1}
 box.snapshot()
 box.cfg{checkpoint_count = default_checkpoint_count}
 fio = require('fio')
-#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1
+test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog')
 -- Bump vclock on the replica again.
 test_run:cmd("switch replica")
 for i = 1, 10 do box.space.test:replace{2} end
diff --git a/test/replication/show_error_on_disconnect.result b/test/replication/show_error_on_disconnect.result
index af082203b..886351449 100644
--- a/test/replication/show_error_on_disconnect.result
+++ b/test/replication/show_error_on_disconnect.result
@@ -75,9 +75,9 @@ box.space.test:select()
 other_id = box.info.id % 2 + 1
 ---
 ...
-box.info.replication[other_id].upstream.status
+test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'stopped' end) or box.info.replication[other_id].upstream.status
 ---
-- stopped
+- true
 ...
 box.info.replication[other_id].upstream.message:match("Missing")
 ---
@@ -96,17 +96,17 @@ box.space.test:select()
 other_id = box.info.id % 2 + 1
 ---
 ...
-box.info.replication[other_id].upstream.status
+test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'follow' end) or box.info.replication[other_id].upstream.status
 ---
-- follow
+- true
 ...
 box.info.replication[other_id].upstream.message
 ---
 - null
 ...
-box.info.replication[other_id].downstream.status
+test_run:wait_cond(function() return box.info.replication[other_id].downstream.status == 'stopped' end) or box.info.replication[other_id].downstream.status
 ---
-- stopped
+- true
 ...
 box.info.replication[other_id].downstream.message:match("Missing")
 ---
diff --git a/test/replication/show_error_on_disconnect.test.lua b/test/replication/show_error_on_disconnect.test.lua
index 40e9dbc5e..aa01f25f1 100644
--- a/test/replication/show_error_on_disconnect.test.lua
+++ b/test/replication/show_error_on_disconnect.test.lua
@@ -30,14 +30,14 @@ 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
+test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'stopped' end) or box.info.replication[other_id].upstream.status
 box.info.replication[other_id].upstream.message:match("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
+test_run:wait_cond(function() return box.info.replication[other_id].upstream.status == 'follow' end) or box.info.replication[other_id].upstream.status
 box.info.replication[other_id].upstream.message
-box.info.replication[other_id].downstream.status
+test_run:wait_cond(function() return box.info.replication[other_id].downstream.status == 'stopped' end) or box.info.replication[other_id].downstream.status
 box.info.replication[other_id].downstream.message:match("Missing")
 test_run:cmd("switch default")
 -- Cleanup.
diff --git a/test/replication/skip_conflict_row.result b/test/replication/skip_conflict_row.result
index 9b2777872..573424a2c 100644
--- a/test/replication/skip_conflict_row.result
+++ b/test/replication/skip_conflict_row.result
@@ -47,9 +47,9 @@ space:insert{2}
 ---
 - [2]
 ...
-box.info.status
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 vclock = test_run:get_vclock('default')
 ---
@@ -65,9 +65,9 @@ box.info.replication[1].upstream.message
 ---
 - null
 ...
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 box.space.test:select()
 ---
@@ -78,9 +78,9 @@ test_run:cmd("switch default")
 ---
 - true
 ...
-box.info.status
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 -- gh-2283: test that if replication_skip_conflict is off vclock
 -- is not advanced on errors.
@@ -120,13 +120,13 @@ lsn1 == box.info.vclock[1]
 ---
 - true
 ...
-box.info.replication[1].upstream.message
+test_run:wait_cond(function() return box.info.replication[1].upstream.message == "Duplicate key exists in unique index 'primary' in space 'test'" end) or box.info.replication[1].upstream.message
 ---
-- Duplicate key exists in unique index 'primary' in space 'test'
+- true
 ...
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info.replication[1].upstream.status
 ---
-- stopped
+- true
 ...
 test_run:cmd("switch default")
 ---
@@ -169,9 +169,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 -- write some conflicting records on slave
 for i = 1, 10 do box.space.test:insert({i, 'r'}) end
@@ -195,15 +195,18 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
+---
+- true
+...
 -- lsn should be incremented
-v1 == box.info.vclock[1] - 10
+test_run:wait_cond(function() return v1 == box.info.vclock[1] - 10 end) or box.info.vclock[1]
 ---
 - true
 ...
--- and state is follow
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 -- restart server and check replication continues from nop-ed vclock
 test_run:cmd("switch default")
@@ -225,9 +228,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
 box.space.test:select({11}, {iterator = "GE"})
 ---
diff --git a/test/replication/skip_conflict_row.test.lua b/test/replication/skip_conflict_row.test.lua
index 2982c730a..914e3486b 100644
--- a/test/replication/skip_conflict_row.test.lua
+++ b/test/replication/skip_conflict_row.test.lua
@@ -16,17 +16,17 @@ box.space.test:insert{1}
 test_run:cmd("switch default")
 space:insert{1, 1}
 space:insert{2}
-box.info.status
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 vclock = test_run:get_vclock('default')
 _ = test_run:wait_vclock("replica", vclock)
 test_run:cmd("switch replica")
 box.info.replication[1].upstream.message
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 box.space.test:select()
 
 test_run:cmd("switch default")
-box.info.status
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 
 -- gh-2283: test that if replication_skip_conflict is off vclock
 -- is not advanced on errors.
@@ -40,8 +40,8 @@ box.space.test:insert{4}
 test_run:cmd("switch replica")
 -- lsn is not promoted
 lsn1 == box.info.vclock[1]
-box.info.replication[1].upstream.message
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.message == "Duplicate key exists in unique index 'primary' in space 'test'" end) or box.info.replication[1].upstream.message
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'stopped' end) or box.info.replication[1].upstream.status
 test_run:cmd("switch default")
 test_run:cmd("restart server replica")
 -- applier is not in follow state
@@ -59,7 +59,7 @@ test_run:cmd("switch default")
 box.space.test:truncate()
 test_run:cmd("restart server replica")
 test_run:cmd("switch replica")
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 -- write some conflicting records on slave
 for i = 1, 10 do box.space.test:insert({i, 'r'}) end
 box.cfg{replication_skip_conflict = true}
@@ -70,10 +70,11 @@ test_run:cmd("switch default")
 for i = 1, 10 do box.space.test:insert({i, 'm'}) end
 
 test_run:cmd("switch replica")
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
+
 -- lsn should be incremented
-v1 == box.info.vclock[1] - 10
--- and state is follow
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return v1 == box.info.vclock[1] - 10 end) or box.info.vclock[1]
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 
 -- restart server and check replication continues from nop-ed vclock
 test_run:cmd("switch default")
@@ -81,7 +82,7 @@ test_run:cmd("stop server replica")
 for i = 11, 20 do box.space.test:insert({i, 'm'}) end
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
-box.info.replication[1].upstream.status
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 box.space.test:select({11}, {iterator = "GE"})
 
 test_run:cmd("switch default")
diff --git a/test/replication/status.result b/test/replication/status.result
index f9d20a923..b569196a0 100644
--- a/test/replication/status.result
+++ b/test/replication/status.result
@@ -222,7 +222,7 @@ master.uuid == box.space._cluster:get(master_id)[2]
 ---
 - true
 ...
-master.upstream.status == "follow"
+test_run:wait_cond(function() return master.upstream.status == 'follow' end) or master.upstream.status
 ---
 - true
 ...
@@ -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_cond(function() return box.info.replication[1].upstream.status == 'stopped' and box.info.replication[1].upstream.message:match('Duplicate') ~= nil end)
 ---
 - true
 ...
diff --git a/test/replication/status.test.lua b/test/replication/status.test.lua
index 8a82fe9ae..c1e363043 100644
--- a/test/replication/status.test.lua
+++ b/test/replication/status.test.lua
@@ -83,7 +83,7 @@ box.info.vclock[master_id] == 2
 master = box.info.replication[master_id]
 master.id == master_id
 master.uuid == box.space._cluster:get(master_id)[2]
-master.upstream.status == "follow"
+test_run:wait_cond(function() return master.upstream.status == 'follow' end) or master.upstream.status
 master.upstream.lag < 1
 master.upstream.idle < 1
 master.upstream.peer:match("localhost")
@@ -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_cond(function() return box.info.replication[1].upstream.status == 'stopped' and box.info.replication[1].upstream.message:match('Duplicate') ~= nil end)
 test_run:cmd('switch default')
 box.space._schema:delete({'dup'})
 test_run:cmd("push filter ', lsn: [0-9]+' to ', lsn: <number>'")
diff --git a/test/replication/sync.result b/test/replication/sync.result
index d3154d02d..2375ddb96 100644
--- a/test/replication/sync.result
+++ b/test/replication/sync.result
@@ -97,6 +97,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
+-----------------------------------------------------------------------------------------------------
 -- Resume replication.
 --
 -- Since max allowed lag is small, all records should arrive
@@ -108,13 +109,13 @@ box.cfg{replication_sync_lag = 0.001}
 box.cfg{replication = replication}
 ---
 ...
-box.space.test:count()
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- 200
+- true
 ...
-box.info.status -- running
+box.space.test:count()
 ---
-- running
+- 200
 ...
 box.info.ro -- false
 ---
@@ -139,6 +140,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
+-----------------------------------------------------------------------------------------------------
 -- Resume replication
 --
 -- Since max allowed lag is big, not all records will arrive
@@ -151,20 +153,12 @@ box.cfg{replication_sync_lag = 1}
 box.cfg{replication = replication}
 ---
 ...
-box.space.test:count() < 400
+test_run:wait_cond(function() return box.space.test:count() == 400 or (box.space.test:count() < 400 and box.info.status == 'running' and box.info.ro) end) or box.info.status
 ---
 - true
 ...
-box.info.status -- running
----
-- running
-...
-box.info.ro -- false
----
-- false
-...
 -- Wait for remaining rows to arrive.
-test_run:wait_cond(function() return box.space.test:count() == 400 end)
+test_run:wait_cond(function() return box.space.test:count() == 400 end) or box.space.test:count()
 ---
 - true
 ...
@@ -187,6 +181,7 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
+-----------------------------------------------------------------------------------------------------
 -- Resume replication
 --
 -- Although max allowed lag is small, box.cfg() will fail to
@@ -199,20 +194,12 @@ box.cfg{replication_sync_lag = 0.001, replication_sync_timeout = 0.001}
 box.cfg{replication = replication}
 ---
 ...
-box.space.test:count() < 600
----
-- true
-...
-box.info.status -- orphan
----
-- orphan
-...
-box.info.ro -- true
+test_run:wait_cond(function() return box.space.test:count() == 600 or (box.space.test:count() < 600 and box.info.status == 'orphan' and box.info.ro) end) or box.info.status
 ---
 - true
 ...
 -- Wait for remaining rows to arrive.
-test_run:wait_cond(function() return box.space.test:count() == 600 end)
+test_run:wait_cond(function() return box.space.test:count() == 600 end) or box.space.test:count()
 ---
 - true
 ...
@@ -221,9 +208,9 @@ test_run:wait_cond(function() return box.info.status ~= 'orphan' end)
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 box.info.ro -- false
 ---
@@ -286,19 +273,19 @@ box.cfg{replication = {}}
 box.cfg{replication = replication}
 ---
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end)
 ---
-- running
+- true
 ...
 box.info.ro -- false
 ---
 - false
 ...
-box.info.replication[1].upstream.status -- follow
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
 ---
-- follow
+- true
 ...
-test_run:grep_log('replica', 'ER_CFG.*')
+test_run:wait_log("replica", "ER_CFG.*", nil, 200)
 ---
 - 'ER_CFG: Incorrect value for option ''replication'': duplicate connection with the
   same replica UUID'
@@ -332,9 +319,9 @@ test_run:cmd("switch replica")
 ---
 - true
 ...
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 ---
-- running
+- true
 ...
 box.info.ro -- false
 ---
diff --git a/test/replication/sync.test.lua b/test/replication/sync.test.lua
index 14dea9716..2d15aeec7 100644
--- a/test/replication/sync.test.lua
+++ b/test/replication/sync.test.lua
@@ -59,6 +59,7 @@ test_run:cmd("switch default")
 fill()
 test_run:cmd("switch replica")
 
+-----------------------------------------------------------------------------------------------------
 -- Resume replication.
 --
 -- Since max allowed lag is small, all records should arrive
@@ -66,8 +67,8 @@ test_run:cmd("switch replica")
 --
 box.cfg{replication_sync_lag = 0.001}
 box.cfg{replication = replication}
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 box.space.test:count()
-box.info.status -- running
 box.info.ro -- false
 
 -- Stop replication.
@@ -79,6 +80,7 @@ test_run:cmd("switch default")
 fill()
 test_run:cmd("switch replica")
 
+-----------------------------------------------------------------------------------------------------
 -- Resume replication
 --
 -- Since max allowed lag is big, not all records will arrive
@@ -87,12 +89,10 @@ test_run:cmd("switch replica")
 --
 box.cfg{replication_sync_lag = 1}
 box.cfg{replication = replication}
-box.space.test:count() < 400
-box.info.status -- running
-box.info.ro -- false
+test_run:wait_cond(function() return box.space.test:count() == 400 or (box.space.test:count() < 400 and box.info.status == 'running' and box.info.ro) end) or box.info.status
 
 -- Wait for remaining rows to arrive.
-test_run:wait_cond(function() return box.space.test:count() == 400 end)
+test_run:wait_cond(function() return box.space.test:count() == 400 end) or box.space.test:count()
 
 -- Stop replication.
 replication = box.cfg.replication
@@ -103,6 +103,7 @@ test_run:cmd("switch default")
 fill()
 test_run:cmd("switch replica")
 
+-----------------------------------------------------------------------------------------------------
 -- Resume replication
 --
 -- Although max allowed lag is small, box.cfg() will fail to
@@ -111,16 +112,14 @@ test_run:cmd("switch replica")
 --
 box.cfg{replication_sync_lag = 0.001, replication_sync_timeout = 0.001}
 box.cfg{replication = replication}
-box.space.test:count() < 600
-box.info.status -- orphan
-box.info.ro -- true
+test_run:wait_cond(function() return box.space.test:count() == 600 or (box.space.test:count() < 600 and box.info.status == 'orphan' and box.info.ro) end) or box.info.status
 
 -- Wait for remaining rows to arrive.
-test_run:wait_cond(function() return box.space.test:count() == 600 end)
+test_run:wait_cond(function() return box.space.test:count() == 600 end) or box.space.test:count()
 
 -- Make sure replica leaves oprhan state.
 test_run:wait_cond(function() return box.info.status ~= 'orphan' end)
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 box.info.ro -- false
 
 -- gh-3636: Check that replica set sync doesn't stop on cfg errors.
@@ -151,10 +150,10 @@ test_run:cmd("switch replica")
 replication = box.cfg.replication
 box.cfg{replication = {}}
 box.cfg{replication = replication}
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end)
 box.info.ro -- false
-box.info.replication[1].upstream.status -- follow
-test_run:grep_log('replica', 'ER_CFG.*')
+test_run:wait_cond(function() return box.info.replication[1].upstream.status == 'follow' end) or box.info.replication[1].upstream.status
+test_run:wait_log("replica", "ER_CFG.*", nil, 200)
 
 test_run:cmd("switch default")
 test_run:cmd("stop server replica")
@@ -165,7 +164,7 @@ box.space.test:replace{123456789}
 box.error.injection.set('ERRINJ_WAL_WRITE_DISK', false)
 test_run:cmd("start server replica")
 test_run:cmd("switch replica")
-box.info.status -- running
+test_run:wait_cond(function() return box.info.status == 'running' end) or box.info.status
 box.info.ro -- false
 
 test_run:cmd("switch default")
diff --git a/test/replication/wal_off.result b/test/replication/wal_off.result
index e0ae84bd7..cf195870c 100644
--- a/test/replication/wal_off.result
+++ b/test/replication/wal_off.result
@@ -93,7 +93,7 @@ box.cfg { replication_sync_timeout = replication_sync_timeout }
 check = "Read access to universe"
 ---
 ...
-while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end
+while (box.info.replication[wal_off_id].upstream.message == nil or string.find(box.info.replication[wal_off_id].upstream.message, check) == nil) do fiber.sleep(0.01) end
 ---
 ...
 box.cfg { replication = "" }
diff --git a/test/replication/wal_off.test.lua b/test/replication/wal_off.test.lua
index 110f2f1f7..3fe412b5a 100644
--- a/test/replication/wal_off.test.lua
+++ b/test/replication/wal_off.test.lua
@@ -32,7 +32,7 @@ box.cfg { replication_sync_timeout = 0.01 }
 box.cfg { replication = wal_off_uri }
 box.cfg { replication_sync_timeout = replication_sync_timeout }
 check = "Read access to universe"
-while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end
+while (box.info.replication[wal_off_id].upstream.message == nil or string.find(box.info.replication[wal_off_id].upstream.message, check) == nil) do fiber.sleep(0.01) end
 box.cfg { replication = "" }
 
 test_run:cmd("stop server wal_off")
diff --git a/test/replication/wal_rw_stress.result b/test/replication/wal_rw_stress.result
index cc68877b0..cfb2f8a9e 100644
--- a/test/replication/wal_rw_stress.result
+++ b/test/replication/wal_rw_stress.result
@@ -71,7 +71,7 @@ test_run:cmd("switch replica")
 box.cfg{replication = replication}
 ---
 ...
-box.info.replication[1].downstream.status ~= 'stopped' or box.info
+test_run:wait_cond(function() return box.info.replication[1].downstream.status ~= 'stopped' end) or box.info
 ---
 - true
 ...
diff --git a/test/replication/wal_rw_stress.test.lua b/test/replication/wal_rw_stress.test.lua
index 08570b285..48d68c5ac 100644
--- a/test/replication/wal_rw_stress.test.lua
+++ b/test/replication/wal_rw_stress.test.lua
@@ -38,7 +38,7 @@ test_run:cmd("setopt delimiter ''");
 -- are running in different threads, there shouldn't be any rw errors.
 test_run:cmd("switch replica")
 box.cfg{replication = replication}
-box.info.replication[1].downstream.status ~= 'stopped' or box.info
+test_run:wait_cond(function() return box.info.replication[1].downstream.status ~= 'stopped' end) or box.info
 test_run:cmd("switch default")
 
 -- Cleanup.
-- 
2.17.1

  reply	other threads:[~2019-04-01 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 14:13 [tarantool-patches] [PATCH v1 1/6] Update the timeouts, set to use the default value avtikhon
2019-04-01 14:13 ` avtikhon [this message]
2019-04-10 12:26   ` [tarantool-patches] Re: [PATCH v1 2/6] Insert status calls inside wait_cond routines Alexander Turenko
2019-04-01 14:13 ` [tarantool-patches] [PATCH v1 3/6] Rename replicas to the each test specified name avtikhon
2021-05-26 21:02   ` [Tarantool-patches] " Alexander Turenko via Tarantool-patches
2019-04-01 14:13 ` [tarantool-patches] [PATCH v1 4/6] Removed unused variable avtikhon
2019-04-01 14:13 ` [tarantool-patches] [PATCH v1 5/6] Test misc tunning avtikhon
2019-04-10 12:29   ` [tarantool-patches] " Alexander Turenko
2019-04-01 14:13 ` [tarantool-patches] [PATCH v1 6/6] Fix wait_fullmesh avtikhon
2019-04-10 12:32 ` [tarantool-patches] Re: [PATCH v1 1/6] Update the timeouts, set to use the default value Alexander Turenko

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=3c1ddecd66058ad9df1164062828d278924b7f46.1554127720.git.avtikhon@gmail.com \
    --to=avtikhon@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=avtikhon@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v1 2/6] Insert status calls inside wait_cond routines' \
    /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