Fixed test findings.
This commit is contained in:
parent
881e352d68
commit
880b3dc5f1
4 changed files with 14 additions and 13 deletions
|
|
@ -1,7 +1,7 @@
|
|||
-- An affinity mode which makes sure connections are rebalanced when a deployment is scaled.
|
||||
-- The advantage of this mode is that the load on the pods will be redistributed.
|
||||
-- The drawback of this mode is that, when scaling up a deployment, roughly (n-c)/n users
|
||||
-- will lose their session, where c is the current number of pods and n is the new number of
|
||||
-- The drawback of this mode is that, when scaling up a deployment, roughly (n-c)/n users
|
||||
-- will lose their session, where c is the current number of pods and n is the new number of
|
||||
-- pods.
|
||||
--
|
||||
local balancer_sticky = require("balancer.sticky")
|
||||
|
|
@ -27,7 +27,7 @@ function _M.new(self, backend)
|
|||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
|
||||
balancer_sticky.sync(o, backend)
|
||||
|
||||
return o
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ function _M.new(self, backend)
|
|||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
|
||||
balancer_sticky.sync(o, backend)
|
||||
|
||||
return o
|
||||
|
|
|
|||
|
|
@ -261,8 +261,8 @@ describe("Sticky", function()
|
|||
assert.spy(s).was_not_called()
|
||||
end
|
||||
|
||||
it("does not set a cookie", test_no_cookie(sticky_balanced))
|
||||
it("does not set a cookie", test_no_cookie(sticky_persistent))
|
||||
it("does not set a cookie", function() test_no_cookie(sticky_balanced) end)
|
||||
it("does not set a cookie", function() test_no_cookie(sticky_persistent) end)
|
||||
|
||||
local function test_correct_endpoint(sticky)
|
||||
local sticky_balancer_instance = sticky:new(test_backend)
|
||||
|
|
@ -340,16 +340,16 @@ describe("Sticky", function()
|
|||
end
|
||||
|
||||
it("changes upstream when change_on_failure option is true", function()
|
||||
test(sticky_balanced, 'balanced', true)
|
||||
test(sticky_balanced, true)
|
||||
end)
|
||||
it("changes upstream when change_on_failure option is true", function()
|
||||
test(sticky_balanced, 'balanced', false)
|
||||
test(sticky_balanced, false)
|
||||
end)
|
||||
it("changes upstream when change_on_failure option is true", function()
|
||||
test(sticky_persistent, 'balanced', true)
|
||||
test(sticky_persistent, true)
|
||||
end)
|
||||
it("changes upstream when change_on_failure option is true", function()
|
||||
test(sticky_persistent, 'balanced', false)
|
||||
test(sticky_persistent, false)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue