Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
box: test the assertion failure after a spurious wakeup in promote
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
1 parent
86384af
commit 73b500f
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
| --- | ||
| ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters