Skip to content

Commit

Permalink
box: test the assertion failure after a spurious wakeup in promote
Browse files Browse the repository at this point in the history
The failure itself was fixed in 68de875
(raft: replace raft_start_candidate with _promote), let's add a
regression test now.

Follow-up #3055
  • Loading branch information
sergepetrenko authored and cyrillos committed Aug 3, 2021
1 parent 86384af commit 73b500f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/replication/gh-3055-promote-wakeup-crash.result
@@ -0,0 +1,48 @@
-- test-run result file version 2
test_run = require('test_run').new()
| ---
| ...
--
-- gh-3055 follow-up: box.ctl.promote() could crash on an assertion after a
-- spurious wakeup.
--
_ = box.space._cluster:insert{2, require('uuid').str()}
| ---
| ...
box.cfg{election_mode='manual',\
replication_synchro_quorum=2,\
election_timeout=1000}
| ---
| ...

fiber = require('fiber')
| ---
| ...
f = fiber.create(function() box.ctl.promote() end)
| ---
| ...
f:set_joinable(true)
| ---
| ...
f:wakeup()
| ---
| ...
fiber.yield()
| ---
| ...

-- Cleanup.
f:cancel()
| ---
| ...
f:join()
| ---
| - false
| - fiber is cancelled
| ...
box.cfg{election_mode='off'}
| ---
| ...
test_run:cleanup_cluster()
| ---
| ...
21 changes: 21 additions & 0 deletions test/replication/gh-3055-promote-wakeup-crash.test.lua
@@ -0,0 +1,21 @@
test_run = require('test_run').new()
--
-- gh-3055 follow-up: box.ctl.promote() could crash on an assertion after a
-- spurious wakeup.
--
_ = box.space._cluster:insert{2, require('uuid').str()}
box.cfg{election_mode='manual',\
replication_synchro_quorum=2,\
election_timeout=1000}

fiber = require('fiber')
f = fiber.create(function() box.ctl.promote() end)
f:set_joinable(true)
f:wakeup()
fiber.yield()

-- Cleanup.
f:cancel()
f:join()
box.cfg{election_mode='off'}
test_run:cleanup_cluster()
1 change: 1 addition & 0 deletions test/replication/suite.cfg
Expand Up @@ -3,6 +3,7 @@
"anon_register_gap.test.lua": {},
"gh-2991-misc-asserts-on-update.test.lua": {},
"gh-3055-election-promote.test.lua": {},
"gh-3055-promote-wakeup-crash.test.lua": {},
"gh-3111-misc-rebootstrap-from-ro-master.test.lua": {},
"gh-3160-misc-heartbeats-on-master-changes.test.lua": {},
"gh-3247-misc-iproto-sequence-value-not-replicated.test.lua": {},
Expand Down

0 comments on commit 73b500f

Please sign in to comment.