aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index a6d2764187..db90cb559f 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -18,6 +18,7 @@ local expect_err = global_helpers.expect_err
local filter = global_helpers.filter
local map = global_helpers.map
local matches = global_helpers.matches
+local near = global_helpers.near
local neq = global_helpers.neq
local ok = global_helpers.ok
local read_file = global_helpers.read_file
@@ -299,8 +300,10 @@ end
-- Calls fn() until it succeeds, up to `max` times or until `max_ms`
-- milliseconds have passed.
local function retry(max, max_ms, fn)
+ assert(max == nil or max > 0)
+ assert(max_ms == nil or max_ms > 0)
local tries = 1
- local timeout = (max_ms and max_ms > 0) and max_ms or 10000
+ local timeout = (max_ms and max_ms or 10000)
local start_time = luv.now()
while true do
local status, result = pcall(fn)
@@ -329,6 +332,7 @@ local function clear(...)
local new_args
local env = nil
local opts = select(1, ...)
+ local headless = true
if type(opts) == 'table' then
if opts.env then
local env_tbl = {}
@@ -354,9 +358,15 @@ local function clear(...)
end
end
new_args = opts.args or {}
+ if opts.headless == false then
+ headless = false
+ end
else
new_args = {...}
end
+ if headless then
+ table.insert(args, '--headless')
+ end
for _, arg in ipairs(new_args) do
table.insert(args, arg)
end
@@ -699,6 +709,7 @@ local module = {
meths = meths,
missing_provider = missing_provider,
mkdir = lfs.mkdir,
+ near = near,
neq = neq,
new_pipename = new_pipename,
next_msg = next_msg,