Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1] test: fix flaky replication/wal_off.test.lua
@ 2020-06-19 11:48 Alexander V. Tikhonov
  2020-06-23 14:11 ` Alexander Turenko
  2020-06-26  9:27 ` Kirill Yukhin
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander V. Tikhonov @ 2020-06-19 11:48 UTC (permalink / raw)
  To: Oleg Piskunov, Sergey Bronnikov; +Cc: tarantool-patches, Alexander Turenko

Found issue:

[003] --- replication/wal_off.result	Thu Apr 25 13:10:18 2019
[003] +++ replication/wal_off.reject	Tue Jul 16 17:10:31 2019
[003] @@ -95,6 +95,8 @@
[003]  ...
[003]  while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end
[003]  ---
[003] +- error: '[string "while string.find(box.info.replication[wal_of..."]:1: bad argument
[003] +    #1 to ''find'' (string expected, got nil)'
[003]  ...
[003]  box.cfg { replication = "" }
[003]  ---

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 #4355
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-4355-replication-wall-off
Issue: https://github.com/tarantool/tarantool/issues/4355

 test/replication/wal_off.result   | 6 ++----
 test/replication/wal_off.test.lua | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/test/replication/wal_off.result b/test/replication/wal_off.result
index e0ae84bd7..f69e58893 100644
--- a/test/replication/wal_off.result
+++ b/test/replication/wal_off.result
@@ -90,11 +90,9 @@ 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
+test_run:wait_upstream(wal_off_id, {status = 'loading', message_re = "Read access to universe"})
 ---
+- true
 ...
 box.cfg { replication = "" }
 ---
diff --git a/test/replication/wal_off.test.lua b/test/replication/wal_off.test.lua
index 110f2f1f7..7298ba1d8 100644
--- a/test/replication/wal_off.test.lua
+++ b/test/replication/wal_off.test.lua
@@ -31,8 +31,7 @@ replication_sync_timeout = box.cfg.replication_sync_timeout
 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
+test_run:wait_upstream(wal_off_id, {status = 'loading', message_re = "Read access to universe"})
 box.cfg { replication = "" }
 
 test_run:cmd("stop server wal_off")
-- 
2.17.1

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

end of thread, other threads:[~2020-06-26  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 11:48 [Tarantool-patches] [PATCH v1] test: fix flaky replication/wal_off.test.lua Alexander V. Tikhonov
2020-06-23 14:11 ` Alexander Turenko
2020-06-26  9:27 ` Kirill Yukhin

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