aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/remote_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-17 16:17:51 +0800
committerGitHub <noreply@github.com>2022-09-17 16:17:51 +0800
commit3c3f3e7353ba2cb9071183cd05036ca2a98d3672 (patch)
tree4c22ef3e90403a5a8e663acbf2ab771fbd08e516 /test/functional/core/remote_spec.lua
parent18139a69bc048aebe592df7a633793bfb9cbea39 (diff)
downloadrneovim-3c3f3e7353ba2cb9071183cd05036ca2a98d3672.tar.gz
rneovim-3c3f3e7353ba2cb9071183cd05036ca2a98d3672.tar.bz2
rneovim-3c3f3e7353ba2cb9071183cd05036ca2a98d3672.zip
test(remote_spec): reduce flakiness in waiting for client exit (#20230)
It is less likely for client to exit between jobstart() and jobwait() if they are invoked in the same RPC request instead of two separate ones.
Diffstat (limited to 'test/functional/core/remote_spec.lua')
-rw-r--r--test/functional/core/remote_spec.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua
index d7bd075eb2..846d79abf3 100644
--- a/test/functional/core/remote_spec.lua
+++ b/test/functional/core/remote_spec.lua
@@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
+local exec_lua = helpers.exec_lua
local expect = helpers.expect
local funcs = helpers.funcs
local insert = helpers.insert
@@ -48,8 +49,8 @@ describe('Remote', function()
-- our incoming --remote calls.
local client_starter = spawn(new_argv(), false, nil, true)
set_session(client_starter)
- local client_job_id = funcs.jobstart(client_argv)
- eq({ 0 }, funcs.jobwait({client_job_id}))
+ -- Call jobstart() and jobwait() in the same RPC request to reduce flakiness.
+ eq({ 0 }, exec_lua([[return vim.fn.jobwait({ vim.fn.jobstart(...) })]], client_argv))
client_starter:close()
set_session(server)
end
@@ -121,8 +122,8 @@ describe('Remote', function()
-- the event loop. If the server event loop is blocked, it can't process
-- our incoming --remote calls.
clear()
- local bogus_job_id = funcs.jobstart(bogus_argv)
- eq({2}, funcs.jobwait({bogus_job_id}))
+ -- Call jobstart() and jobwait() in the same RPC request to reduce flakiness.
+ eq({ 2 }, exec_lua([[return vim.fn.jobwait({ vim.fn.jobstart(...) })]], bogus_argv))
end
it('bogus subcommand', function()
run_and_check_exit_code('--remote-bogus')