Merge pull request #3504 from Shopify/fix-ewma-test

fix an ewma unit test
This commit is contained in:
Kubernetes Prow Robot 2018-12-03 04:36:14 -08:00 committed by GitHub
commit 95f7c96be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -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)

View file

@ -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 })