Skip to content

Commit

Permalink
Merge pull request Kong#2487 from Mashape/tests/fix-rate-limiting
Browse files Browse the repository at this point in the history
tests(rate-limiting) fix a couple of tests
  • Loading branch information
subnetmarco authored May 2, 2017
2 parents 78d0389 + 8169b8c commit 3312481
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/03-plugins/24-rate-limiting/04-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ for i, policy in ipairs({"local", "cluster", "redis"}) do
})
local body = assert.res_status(429, res)
local json = cjson.decode(body)
assert.same({ message = "API rate limit exceeded" }, body)
assert.same({ message = "API rate limit exceeded" }, json)
assert.are.equal(2, tonumber(res.headers["x-ratelimit-remaining-hour"]))
assert.are.equal(0, tonumber(res.headers["x-ratelimit-remaining-minute"]))
end)
Expand Down Expand Up @@ -464,6 +464,8 @@ for i, policy in ipairs({"local", "cluster", "redis"}) do
describe("Fault tolerancy", function()

before_each(function()
helpers.kill_all()

local api1 = assert(helpers.dao.apis:insert {
name = "failtest3_com",
hosts = { "failtest3.com" },
Expand All @@ -485,6 +487,8 @@ for i, policy in ipairs({"local", "cluster", "redis"}) do
api_id = api2.id,
config = { minute = 6, policy = policy, redis_host = "5.5.5.5", fault_tolerant = true }
})

assert(helpers.start_kong())
end)

it("does not work if an error occurs", function()
Expand Down

0 comments on commit 3312481

Please sign in to comment.