lua randomseed per worker

This commit is contained in:
Elvin Efendi 2018-12-19 17:46:53 +04:00
parent 66aecbd0b2
commit 4896b064ca
6 changed files with 51 additions and 3 deletions

View file

@ -0,0 +1,9 @@
describe("lua_ingress", function()
it("patches math.randomseed to not be called more than once per worker", function()
local s = spy.on(ngx, "log")
math.randomseed(100)
assert.spy(s).was_called_with(ngx.WARN,
string.format("ignoring math.randomseed(%d) since PRNG is already seeded for worker %d", 100, ngx.worker.pid()))
end)
end)