Skip to content

Commit

Permalink
test: fix box/misc failure in parallel mode
Browse files Browse the repository at this point in the history
Rewrite the test so that it doesn't depend on timeouts, which can be
exceeded under high load, and simplify it a little.

Closes #4134
  • Loading branch information
sergepetrenko committed Apr 11, 2019
1 parent 319ab0a commit d0e8a9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
19 changes: 6 additions & 13 deletions test/box/misc.result
Original file line number Diff line number Diff line change
Expand Up @@ -1378,16 +1378,17 @@ _ = box.ctl.on_shutdown(function() print("on_shutdown 5") end)
...
-- Check that we don't hang infinitely after os.exit()
-- even if the following code doesn't yield.
fiber = require("fiber")
---
...
_ = fiber.create(function() fiber.sleep(0.05) os.exit() while true do end end)
fiber = require('fiber')
---
...
test_run:cmd("switch default")
---
- true
...
test_run:eval("test", "_ = fiber.new(function() os.exit() while true do end end)")
---
- []
...
fiber.sleep(0.1)
---
...
Expand All @@ -1401,11 +1402,7 @@ test_run:cmd("start server test")
---
- true
...
test_run:cmd("switch test")
---
- true
...
test_run:grep_log('test', 'on_shutdown 5', nil, {noreset=true})
test_run:wait_log('test', 'on_shutdown 5', nil, 5, {noreset=true})
---
- on_shutdown 5
...
Expand All @@ -1414,10 +1411,6 @@ test_run:grep_log('test', 'signal', nil, {noreset=true})
---
- null
...
test_run:cmd("switch default")
---
- true
...
test_run:cmd("stop server test")
---
- true
Expand Down
8 changes: 3 additions & 5 deletions test/box/misc.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,19 +398,17 @@ test_run:cmd("switch test")
_ = box.ctl.on_shutdown(function() print("on_shutdown 5") end)
-- Check that we don't hang infinitely after os.exit()
-- even if the following code doesn't yield.
fiber = require("fiber")
_ = fiber.create(function() fiber.sleep(0.05) os.exit() while true do end end)
fiber = require('fiber')
test_run:cmd("switch default")
test_run:eval("test", "_ = fiber.new(function() os.exit() while true do end end)")
fiber.sleep(0.1)
-- The server should be already stopped by os.exit(),
-- but start doesn't work without a prior call to stop.
test_run:cmd("stop server test")
test_run:cmd("start server test")
test_run:cmd("switch test")
test_run:grep_log('test', 'on_shutdown 5', nil, {noreset=true})
test_run:wait_log('test', 'on_shutdown 5', nil, 5, {noreset=true})
-- make sure we exited because of os.exit(), not a signal.
test_run:grep_log('test', 'signal', nil, {noreset=true})
test_run:cmd("switch default")
test_run:cmd("stop server test")
test_run:cmd("cleanup server test")
test_run:cmd("delete server test")

0 comments on commit d0e8a9f

Please sign in to comment.