merge from master
This commit is contained in:
commit
ce6e564f82
86 changed files with 1448 additions and 3530 deletions
|
|
@ -26,10 +26,6 @@ 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 }
|
||||
ngx.shared.balancer_ewma.get = function(self, key) return stats[key] end
|
||||
local t = ngx.now()-10
|
||||
ngx.shared.balancer_ewma_last_touched_at.get = function(self, key) return t end
|
||||
|
||||
|
||||
local peer = instance:balance()
|
||||
assert.equal("10.184.97.100:8080", peer)
|
||||
|
|
@ -52,13 +48,7 @@ describe("Balancer ewma", function()
|
|||
endpoints = { { address = "10.184.7.40", port = "8080", maxFails = 0, failTimeout = 0 } }
|
||||
}
|
||||
|
||||
local s1 = spy.on(ngx.shared.balancer_ewma, "flush_all")
|
||||
local s2 = spy.on(ngx.shared.balancer_ewma_last_touched_at, "flush_all")
|
||||
|
||||
instance:sync(new_backend)
|
||||
|
||||
assert.spy(s1).was_not_called()
|
||||
assert.spy(s2).was_not_called()
|
||||
end)
|
||||
|
||||
it("updates endpoints", function()
|
||||
|
|
@ -77,13 +67,7 @@ describe("Balancer ewma", function()
|
|||
local new_backend = util.deepcopy(backend)
|
||||
new_backend.endpoints[1].maxFails = 3
|
||||
|
||||
local s1 = spy.on(ngx.shared.balancer_ewma, "flush_all")
|
||||
local s2 = spy.on(ngx.shared.balancer_ewma_last_touched_at, "flush_all")
|
||||
|
||||
instance:sync(new_backend)
|
||||
|
||||
assert.spy(s1).was_called()
|
||||
assert.spy(s2).was_called()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ describe("Sticky", function()
|
|||
local cookie_instance = {
|
||||
set = function(self, payload)
|
||||
assert.equal(payload.key, test_backend.sessionAffinityConfig.cookieSessionAffinity.name)
|
||||
assert.equal(payload.value, util[test_backend_hash_fn .. "_digest"](test_backend_endpoint))
|
||||
local expected_len = #util[test_backend_hash_fn .. "_digest"]("anything")
|
||||
assert.equal(#payload.value, expected_len)
|
||||
assert.equal(payload.path, ngx.var.location_path)
|
||||
assert.equal(payload.domain, nil)
|
||||
assert.equal(payload.httponly, true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue