Skip to content

Commit

Permalink
fix an ewma unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvinEfendi committed Dec 3, 2018
1 parent 03dba21 commit a4bad90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rootfs/etc/nginx/lua/test/balancer/ewma_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions rootfs/etc/nginx/lua/test/run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 })

0 comments on commit a4bad90

Please sign in to comment.