2018-07-18 02:27:10 +00:00
|
|
|
local ffi = require("ffi")
|
2018-12-19 13:46:53 +00:00
|
|
|
local lua_ingress = require("lua_ingress")
|
2018-07-18 02:27:10 +00:00
|
|
|
|
|
|
|
-- without this we get errors such as "attempt to redefine XXX"
|
|
|
|
local old_cdef = ffi.cdef
|
|
|
|
local exists = {}
|
|
|
|
ffi.cdef = function(def)
|
|
|
|
if exists[def] then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
exists[def] = true
|
|
|
|
return old_cdef(def)
|
|
|
|
end
|
|
|
|
|
|
|
|
local old_udp = ngx.socket.udp
|
|
|
|
ngx.socket.udp = function(...)
|
|
|
|
local socket = old_udp(...)
|
|
|
|
socket.send = function(...)
|
|
|
|
error("ngx.socket.udp:send please mock this to use in tests")
|
|
|
|
end
|
|
|
|
return socket
|
|
|
|
end
|
|
|
|
|
|
|
|
local old_tcp = ngx.socket.tcp
|
|
|
|
ngx.socket.tcp = function(...)
|
|
|
|
local socket = old_tcp(...)
|
|
|
|
socket.send = function(...)
|
|
|
|
error("ngx.socket.tcp:send please mock this to use in tests")
|
|
|
|
end
|
|
|
|
return socket
|
|
|
|
end
|
|
|
|
|
2018-08-16 18:12:33 +00:00
|
|
|
ngx.log = function(...) end
|
|
|
|
ngx.print = function(...) end
|
|
|
|
|
2018-12-19 13:46:53 +00:00
|
|
|
lua_ingress.init_worker()
|
2018-12-03 11:56:58 +00:00
|
|
|
|
2018-07-18 02:27:10 +00:00
|
|
|
require "busted.runner"({ standalone = false })
|