cleanup lua tests

This commit is contained in:
Elvin Efendi 2018-07-21 22:36:05 -04:00
parent fe9bb6bee5
commit fcaf337b30
13 changed files with 4 additions and 67 deletions

View file

@ -1,12 +1,5 @@
package.path = "./rootfs/etc/nginx/lua/?.lua;./rootfs/etc/nginx/lua/test/mocks/?.lua;" .. package.path
_G._TEST = true
local _ngx = {
shared = {},
log = function(...) end,
}
_G.ngx = _ngx
local balancer, expected_implementations, backends
local function reset_balancer()
@ -92,10 +85,10 @@ describe("Balancer", function()
local s_old = spy.on(implementation, "new")
local s = spy.on(new_implementation, "new")
local s_ngx_log = spy.on(_G.ngx, "log")
local s_ngx_log = spy.on(ngx, "log")
assert.has_no.errors(function() balancer.sync_backend(backend) end)
assert.spy(s_ngx_log).was_called_with(ngx.ERR,
assert.spy(s_ngx_log).was_called_with(ngx.INFO,
"LB algorithm changed from round_robin to ewma, resetting the instance")
-- TODO(elvinefendi) figure out why
-- assert.spy(s).was_called_with(new_implementation, backend) does not work here