refactor lua balancer and fix ipv6 issue
This commit is contained in:
parent
082325b6f5
commit
4b07e73e5d
7 changed files with 16 additions and 29 deletions
|
|
@ -11,9 +11,8 @@ describe("Balancer ewma", function()
|
|||
}
|
||||
local instance = balancer_ewma:new(backend)
|
||||
|
||||
local host, port = instance:balance()
|
||||
assert.equal("10.184.7.40", host)
|
||||
assert.equal("8080", port)
|
||||
local peer = instance:balance()
|
||||
assert.equal("10.184.7.40:8080", peer)
|
||||
end)
|
||||
|
||||
it("picks the endpoint with lowest score when there two of them", function()
|
||||
|
|
@ -32,9 +31,8 @@ describe("Balancer ewma", function()
|
|||
ngx.shared.balancer_ewma_last_touched_at.get = function(self, key) return t end
|
||||
|
||||
|
||||
local host, port = instance:balance()
|
||||
assert.equal("10.184.97.100", host)
|
||||
assert.equal("8080", port)
|
||||
local peer = instance:balance()
|
||||
assert.equal("10.184.97.100:8080", peer)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue