Merge pull request #3504 from Shopify/fix-ewma-test
fix an ewma unit test
This commit is contained in:
commit
95f7c96be0
2 changed files with 5 additions and 2 deletions
|
@ -42,8 +42,8 @@ describe("Balancer ewma", function()
|
|||
}
|
||||
}
|
||||
local instance = balancer_ewma:new(backend)
|
||||
|
||||
local stats = { ["10.184.7.40:8080"] = 0.5, ["10.184.97.100:8080"] = 0.3 }
|
||||
instance.ewma = { ["10.184.7.40:8080"] = 0.5, ["10.184.97.100:8080"] = 0.3 }
|
||||
instance.ewma_last_touched_at = { ["10.184.7.40:8080"] = ngx.now(), ["10.184.97.100:8080"] = ngx.now() }
|
||||
|
||||
local peer = instance:balance()
|
||||
assert.equal("10.184.97.100:8080", peer)
|
||||
|
|
|
@ -32,4 +32,7 @@ end
|
|||
ngx.log = function(...) end
|
||||
ngx.print = function(...) end
|
||||
|
||||
-- TODO(elvinefendi) once this is implemented for production (should be!), share the same code
|
||||
math.randomseed(ngx.time() + ngx.worker.pid())
|
||||
|
||||
require "busted.runner"({ standalone = false })
|
||||
|
|
Loading…
Reference in a new issue