This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Kong 0.14.0 upgrades * Fix OpenSSL dir name * Update Busted test runner * Fix for PG connection refused in Heroku CI * Kong 0.14.1 upgrade
- Loading branch information
Showing
10 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,70 @@ | ||
#!/usr/bin/env resty | ||
|
||
local DEFAULT_RESTY_FLAGS="-c 4096" | ||
|
||
do | ||
local lines = getmetatable(io.output()).lines | ||
|
||
getmetatable(io.output()).lines = function(self, ...) | ||
local iter = lines(self, ...) | ||
|
||
return function() | ||
local ok, ret = pcall(iter) | ||
if ok then | ||
return ret | ||
end | ||
end | ||
end | ||
end | ||
|
||
if not os.getenv("KONG_BUSTED_RESPAWNED") then | ||
-- initial run, so go update the environment | ||
local script = {} | ||
for line in io.popen("set"):lines() do | ||
local ktvar, val = line:match("^KONG_TEST_([^=]*)=(.*)") | ||
if ktvar then | ||
-- reinserted KONG_TEST_xxx as KONG_xxx; append | ||
table.insert(script, "export KONG_" .. ktvar .. "=" ..val) | ||
end | ||
|
||
local var = line:match("^(KONG_[^=]*)") | ||
if var then | ||
-- remove existing KONG_xxx and KONG_TEST_xxx variables; prepend | ||
table.insert(script, 1, "unset " .. var) | ||
end | ||
end | ||
-- add cli recursion detection | ||
table.insert(script, "export KONG_BUSTED_RESPAWNED=1") | ||
|
||
-- rebuild the invoked commandline, while inserting extra resty-flags | ||
local resty_flags = DEFAULT_RESTY_FLAGS | ||
local cmd = { "exec" } | ||
for i = -1, #arg do | ||
if arg[i]:sub(1, 12) == "RESTY_FLAGS=" then | ||
resty_flags = arg[i]:sub(13, -1) | ||
|
||
else | ||
table.insert(cmd, "'" .. arg[i] .. "'") | ||
end | ||
end | ||
|
||
if resty_flags then | ||
table.insert(cmd, 3, resty_flags) | ||
end | ||
|
||
table.insert(script, table.concat(cmd, " ")) | ||
|
||
-- recurse cli command, with proper variables (un)set for clean testing | ||
local _, _, rc = os.execute(table.concat(script, "; ")) | ||
os.exit(rc) | ||
end | ||
|
||
require "luarocks.loader" | ||
|
||
require("kong.core.globalpatches")({ | ||
require("kong.globalpatches")({ | ||
cli = true, | ||
rbusted = true | ||
}) | ||
|
||
package.path = "?/init.lua;"..package.path | ||
|
||
-- Busted command-line runner | ||
require 'busted.runner'({ standalone = false }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.