Skip to content

Commit

Permalink
replication: fix flaky gh-3055-election-promote test
Browse files Browse the repository at this point in the history
Found the following error in our CI:

[001] Test failed! Result content mismatch:
[001] --- replication/gh-3055-election-promote.result	Mon Aug  2 17:52:55 2021
[001] +++ var/rejects/replication/gh-3055-election-promote.reject	Mon Aug  9 10:29:34 2021
[001] @@ -88,7 +88,7 @@
[001]   | ...
[001]  assert(not box.info.ro)
[001]   | ---
[001] - | - true
[001] + | - error: assertion failed!
[001]   | ...
[001]  assert(box.info.election.term > term)
[001]   | ---
[001]

The problem was the same as in recently fixed election_qsync.test
(commit 096a0a7): PROMOTE is written to
WAL asynchronously, and box.ctl.promote() returns earlier than this
happens.

Fix the issue by waiting for the instance to become writeable.

Follow-up #6034
  • Loading branch information
sergepetrenko authored and kyukhin committed Aug 12, 2021
1 parent 74177dd commit 1df9960
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/replication/gh-3055-election-promote.result
Expand Up @@ -50,7 +50,7 @@ assert(box.info.election.state == 'leader')
| ---
| - true
| ...
assert(not box.info.ro)
test_run:wait_cond(function() return not box.info.ro end)
| ---
| - true
| ...
Expand Down Expand Up @@ -86,7 +86,7 @@ assert(box.info.election.state == 'leader')
| ---
| - true
| ...
assert(not box.info.ro)
test_run:wait_cond(function() return not box.info.ro end)
| ---
| - true
| ...
Expand Down
4 changes: 2 additions & 2 deletions test/replication/gh-3055-election-promote.test.lua
Expand Up @@ -24,7 +24,7 @@ assert(box.info.election.state == 'follower')
term = box.info.election.term
box.ctl.promote()
assert(box.info.election.state == 'leader')
assert(not box.info.ro)
test_run:wait_cond(function() return not box.info.ro end)
assert(box.info.election.term > term)

-- Test promote when there's a live leader.
Expand All @@ -35,7 +35,7 @@ assert(box.info.ro)
assert(box.info.election.leader ~= 0)
box.ctl.promote()
assert(box.info.election.state == 'leader')
assert(not box.info.ro)
test_run:wait_cond(function() return not box.info.ro end)
assert(box.info.election.term > term)

-- Cleanup.
Expand Down

0 comments on commit 1df9960

Please sign in to comment.