[Tarantool-patches] [PATCH v3 10/10] box.ctl: rename clear_synchro_queue to promote
Serge Petrenko
sergepetrenko at tarantool.org
Fri Apr 16 19:13:42 MSK 2021
16.04.2021 02:31, Vladislav Shpilevoy пишет:
> Thanks for the patch!
>
>> diff --git a/test/replication/election_basic.result b/test/replication/election_basic.result
>> index d5320b3ff..78c911245 100644
>> --- a/test/replication/election_basic.result
>> +++ b/test/replication/election_basic.result
>> @@ -108,6 +108,31 @@ assert(box.info.election.leader == box.info.id)
>> | - true
>> | ...
>>
>> +-- Manual election mode. A voter most of the time, a leader once
>> +-- `box.ctl.promote()` is called.
>> +box.cfg{election_mode = 'manual'}
>> + | ---
>> + | ...
>> +
>> +assert(box.info.election.state == 'follower')
>> + | ---
>> + | - true
>> + | ...
>> +term = box.info.election.term
>> + | ---
>> + | ...
>> +box.ctl.promote()
>> + | ---
>> + | ...
>> +assert(box.info.election.state == 'leader')
>> + | ---
>> + | - error: assertion failed!
>> + | ...
>> +assert(box.info.election.term > term)
>> + | ---
>> + | - error: assertion failed!
> Hm. Shouldn't these assertions pass?
Ouch. Yes, they should. The assertions failed because
promote does nothing when node was a leader in this term.
So we can't test box.ctl.promote() with one instance.
The test will fail as long as the instance already was the
leader in current term. And this is the only case when
there is only one instance in test.
Even if I move election_mode='manual' above the
election_mode='candidate', the same test will fail on conf='vinyl'.
===============================
diff --git a/test/replication/election_basic.result
b/test/replication/election_basic.result
index 78c911245..d5320b3ff 100644
--- a/test/replication/election_basic.result
+++ b/test/replication/election_basic.result
@@ -108,31 +108,6 @@ assert(box.info.election.leader == box.info.id)
| - true
| ...
--- Manual election mode. A voter most of the time, a leader once
--- `box.ctl.promote()` is called.
-box.cfg{election_mode = 'manual'}
- | ---
- | ...
-
-assert(box.info.election.state == 'follower')
- | ---
- | - true
- | ...
-term = box.info.election.term
- | ---
- | ...
-box.ctl.promote()
- | ---
- | ...
-assert(box.info.election.state == 'leader')
- | ---
- | - error: assertion failed!
- | ...
-assert(box.info.election.term > term)
- | ---
- | - error: assertion failed!
- | ...
-
box.cfg{ \
election_mode =
'off', \
election_timeout =
old_election_timeout \
diff --git a/test/replication/election_basic.test.lua
b/test/replication/election_basic.test.lua
index 5fc398848..821f73cea 100644
--- a/test/replication/election_basic.test.lua
+++ b/test/replication/election_basic.test.lua
@@ -39,16 +39,6 @@ assert(box.info.election.term > term)
assert(box.info.election.vote == box.info.id)
assert(box.info.election.leader == box.info.id)
--- Manual election mode. A voter most of the time, a leader once
--- `box.ctl.promote()` is called.
-box.cfg{election_mode = 'manual'}
-
-assert(box.info.election.state == 'follower')
-term = box.info.election.term
-box.ctl.promote()
-assert(box.info.election.state == 'leader')
-assert(box.info.election.term > term)
-
box.cfg{ \
election_mode =
'off', \
election_timeout =
old_election_timeout \
--
Serge Petrenko
More information about the Tarantool-patches
mailing list