Skip to content

Commit

Permalink
test(lambda): add an initial request to prevent timeouts in testing (K…
Browse files Browse the repository at this point in the history
…ong#2265)

The lambda environment needs to warm up, the initial request may be very
slow. This occasionally causes timeouts on the tests, which then fail.
  • Loading branch information
Tieske authored Mar 30, 2017
1 parent fcdc1f3 commit 476d6ab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/03-plugins/23-aws-lambda/01-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ describe("Plugin: AWS Lambda (access)", function()
})

assert(helpers.start_kong())

-- Improve test reliability here: warm up AWS lambda because the first
-- invocation will take the most time
client = helpers.proxy_client()
client:set_timeout(2 * 60 * 1000) -- 2 minute timeout for the warmup
local res = assert(client:send {
method = "GET",
path = "/get?key1=some_value1&key2=some_value2&key3=some_value3",
headers = {
["Host"] = "lambda.com"
}
})
client:close()
end)

before_each(function()
Expand Down

0 comments on commit 476d6ab

Please sign in to comment.