fixed test case for math.randomseed.

This commit is contained in:
WenMing 2019-01-18 10:08:33 +08:00
parent 011062967a
commit c782f22c5d
2 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,7 @@ math.randomseed = function()
local seed = seeds[pid]
if seed then
ngx.log(ngx.WARN,
string.format("ignoring math.randomseed(%d) since PRNG is already seeded for worker %d", seed, pid))
string.format("ignoring math.randomseed() since PRNG is already seeded for worker %d", pid))
return
end

View file

@ -2,8 +2,8 @@ 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)
math.randomseed()
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()))
string.format("ignoring math.randomseed() since PRNG is already seeded for worker %d", ngx.worker.pid()))
end)
end)