Skip to content

Commit

Permalink
tests(dbless) reduce flakiness in declarative startup test
Browse files Browse the repository at this point in the history
Initial declarative config initialization may not be fully done by the time
the proxy port starts responding.
  • Loading branch information
hishamhm committed Aug 15, 2019
1 parent 6fcd28a commit 0e4d69e
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions spec/02-integration/02-cmd/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,30 @@ describe("kong start/stop #" .. strategy, function()
nginx_conf = "spec/fixtures/custom_nginx.template",
}))

-- get a connection, retry until kong starts
helpers.wait_until(function()
local pok
pok, proxy_client = pcall(helpers.proxy_client)
return pok
end, 10)
-- get a connection, retry until kong starts
helpers.wait_until(function()
local pok
pok, proxy_client = pcall(helpers.proxy_client)
return pok
end, 10)

local res = assert(proxy_client:send {
method = "GET",
path = "/",
headers = {
host = "example.test",
}
})
local ok = res.status == 200

local res = assert(proxy_client:send {
method = "GET",
path = "/",
headers = {
host = "example.test",
}
})
assert.res_status(200, res)
if proxy_client then
proxy_client:close()
proxy_client = nil
end

return ok
end, 10)
end)
end)
end
Expand Down

0 comments on commit 0e4d69e

Please sign in to comment.