refactor(tests): lift retry() into assert_log()

This commit is contained in:
Justin M. Keyes
2023-01-17 00:12:59 +01:00
parent 6ec7bcb618
commit 665a7dafaf
8 changed files with 50 additions and 69 deletions

View File

@@ -1,6 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
local assert_log = helpers.assert_log
local retry = helpers.retry
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
local clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
local ok = helpers.ok
@@ -88,9 +87,7 @@ describe('server', function()
}}
eq(0, eval("serverstop('')"))
eq(0, eval("serverstop('bogus-socket-name')"))
retry(nil, 1000, function()
assert_log('Not listening on bogus%-socket%-name', testlog, 10)
end)
assert_log('Not listening on bogus%-socket%-name', testlog, 10)
end)
it('parses endpoints', function()
@@ -121,9 +118,7 @@ describe('server', function()
if status then
table.insert(expected, v4)
pcall(funcs.serverstart, v4) -- exists already; ignore
retry(nil, 1000, function()
assert_log('Failed to start server: address already in use: 127%.0%.0%.1', testlog, 10)
end)
assert_log('Failed to start server: address already in use: 127%.0%.0%.1', testlog, 10)
end
local v6 = '::1:12345'
@@ -131,9 +126,7 @@ describe('server', function()
if status then
table.insert(expected, v6)
pcall(funcs.serverstart, v6) -- exists already; ignore
retry(nil, 1000, function()
assert_log('Failed to start server: address already in use: ::1', testlog, 10)
end)
assert_log('Failed to start server: address already in use: ::1', testlog, 10)
end
eq(expected, funcs.serverlist())
clear_serverlist()