[Tarantool-patches] [PATCH v2 2/2] replication: fix flaky election_basic test

Serge Petrenko sergepetrenko at tarantool.org
Mon Aug 16 18:15:23 MSK 2021


Found the following error in our CI:

 Test failed! Result content mismatch:
 --- replication/election_basic.result	Fri Aug 13 13:50:26 2021
 +++ /build/usr/src/debug/tarantool-2.9.0.276/test/var/rejects/replication/election_basic.reject	Sat Aug 14 08:14:17 2021
 @@ -116,6 +116,7 @@
   | ...
  box.ctl.demote()
   | ---
 + | - error: box.ctl.demote does not support simultaneous invocations
   | ...
  --

Even though box.ctl.demote() or box.ctl.promote() isn't called above the
failing line, promote() is issued internally once the instance becomes
the leader.

Wait until previous promote is finished
(i.e. box.info.synchro.queue.owner is set)
---
 test/replication/election_basic.result   | 6 ++++++
 test/replication/election_basic.test.lua | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/test/replication/election_basic.result b/test/replication/election_basic.result
index 5da57e87d..382aeef60 100644
--- a/test/replication/election_basic.result
+++ b/test/replication/election_basic.result
@@ -95,6 +95,12 @@ test_run:wait_cond(function() return box.info.election.state == 'leader' end)
  | ---
  | - true
  | ...
+test_run:wait_cond(function()\
+    return box.info.synchro.queue.owner == box.info.id\
+end)
+ | ---
+ | - true
+ | ...
 assert(box.info.election.term > term)
  | ---
  | - true
diff --git a/test/replication/election_basic.test.lua b/test/replication/election_basic.test.lua
index 3b3a3e7e5..47f3d318e 100644
--- a/test/replication/election_basic.test.lua
+++ b/test/replication/election_basic.test.lua
@@ -35,6 +35,9 @@ assert(box.info.election.leader == 0)
 box.cfg{election_timeout = 1000}
 box.cfg{election_mode = 'candidate'}
 test_run:wait_cond(function() return box.info.election.state == 'leader' end)
+test_run:wait_cond(function()\
+    return box.info.synchro.queue.owner == box.info.id\
+end)
 assert(box.info.election.term > term)
 assert(box.info.election.vote == box.info.id)
 assert(box.info.election.leader == box.info.id)
-- 
2.30.1 (Apple Git-130)



More information about the Tarantool-patches mailing list