mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-03 12:37:36 +08:00
test: make CI pass again (#2619)
This commit is contained in:
parent
61cd91440b
commit
366d5040cf
@ -60,6 +60,9 @@ script() {
|
||||
sudo PATH=$PATH ./utils/install-apisix.sh install > build.log 2>&1 || (cat build.log && exit 1)
|
||||
|
||||
which apisix
|
||||
# TODO: DELETE ME AFTER
|
||||
sudo cp ../bin/apisix /usr/bin/apisix
|
||||
lua -e 'print(package.path)'
|
||||
|
||||
# run test
|
||||
sudo PATH=$PATH apisix help
|
||||
@ -72,6 +75,10 @@ script() {
|
||||
# install APISIX by luarocks
|
||||
sudo luarocks install $APISIX_MAIN > build.log 2>&1 || (cat build.log && exit 1)
|
||||
|
||||
# TODO: DELETE ME AFTER
|
||||
sudo cp ../bin/apisix /usr/bin/apisix
|
||||
lua -e 'print(package.path)'
|
||||
|
||||
# show install files
|
||||
luarocks show apisix
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
-- limitations under the License.
|
||||
--
|
||||
|
||||
local require = require
|
||||
local util = require("apisix.cli.util")
|
||||
|
||||
local pcall = pcall
|
||||
@ -22,61 +23,59 @@ local error = error
|
||||
local exit = os.exit
|
||||
local stderr = io.stderr
|
||||
local str_find = string.find
|
||||
local pkg_cpath_org = package.cpath
|
||||
local pkg_path_org = package.path
|
||||
local arg = arg
|
||||
local package = package
|
||||
|
||||
local min_etcd_version = "3.4.0"
|
||||
local apisix_home = "/usr/local/apisix"
|
||||
local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
|
||||
.. apisix_home .. "/deps/lib/lua/5.1/?.so;;"
|
||||
local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;"
|
||||
|
||||
-- only for developer, use current folder as working space
|
||||
local is_root_path = false
|
||||
local script_path = arg[0]
|
||||
if script_path:sub(1, 2) == './' then
|
||||
apisix_home = util.trim(util.execute_cmd("pwd"))
|
||||
if not apisix_home then
|
||||
error("failed to fetch current path")
|
||||
return function (apisix_home, pkg_cpath_org, pkg_path_org)
|
||||
-- only for developer, use current folder as working space
|
||||
local is_root_path = false
|
||||
local script_path = arg[0]
|
||||
if script_path:sub(1, 2) == './' then
|
||||
apisix_home = util.trim(util.execute_cmd("pwd"))
|
||||
if not apisix_home then
|
||||
error("failed to fetch current path")
|
||||
end
|
||||
|
||||
if str_find(apisix_home .. "/", '/root/', nil, true) == 1 then
|
||||
is_root_path = true
|
||||
end
|
||||
|
||||
local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
|
||||
.. apisix_home .. "/deps/lib/lua/5.1/?.so;"
|
||||
|
||||
local pkg_path = apisix_home .. "/?/init.lua;"
|
||||
.. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
|
||||
|
||||
package.cpath = pkg_cpath .. package.cpath
|
||||
package.path = pkg_path .. package.path
|
||||
end
|
||||
|
||||
if str_find(apisix_home .. "/", '/root/', nil, true) == 1 then
|
||||
is_root_path = true
|
||||
end
|
||||
|
||||
pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
|
||||
.. apisix_home .. "/deps/lib/lua/5.1/?.so;"
|
||||
|
||||
pkg_path = apisix_home .. "/?/init.lua;"
|
||||
.. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
|
||||
end
|
||||
|
||||
package.cpath = pkg_cpath .. pkg_cpath_org
|
||||
package.path = pkg_path .. pkg_path_org
|
||||
|
||||
do
|
||||
-- skip luajit environment
|
||||
local ok = pcall(require, "table.new")
|
||||
if not ok then
|
||||
local ok, json = pcall(require, "cjson")
|
||||
if ok and json then
|
||||
stderr:write("please remove the cjson library in Lua, it may "
|
||||
.. "conflict with the cjson library in openresty. "
|
||||
.. "\n luarocks remove cjson\n")
|
||||
exit(1)
|
||||
do
|
||||
-- skip luajit environment
|
||||
local ok = pcall(require, "table.new")
|
||||
if not ok then
|
||||
local ok, json = pcall(require, "cjson")
|
||||
if ok and json then
|
||||
stderr:write("please remove the cjson library in Lua, it may "
|
||||
.. "conflict with the cjson library in openresty. "
|
||||
.. "\n luarocks remove cjson\n")
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local openresty_args = [[openresty -p ]] .. apisix_home .. [[ -c ]]
|
||||
.. apisix_home .. [[/conf/nginx.conf]]
|
||||
|
||||
local min_etcd_version = "3.4.0"
|
||||
|
||||
return {
|
||||
apisix_home = apisix_home,
|
||||
is_root_path = is_root_path,
|
||||
openresty_args = openresty_args,
|
||||
pkg_cpath_org = pkg_cpath_org,
|
||||
pkg_path_org = pkg_path_org,
|
||||
min_etcd_version = min_etcd_version,
|
||||
}
|
||||
end
|
||||
|
||||
local openresty_args = [[openresty -p ]] .. apisix_home .. [[ -c ]]
|
||||
.. apisix_home .. [[/conf/nginx.conf]]
|
||||
|
||||
|
||||
return {
|
||||
apisix_home = apisix_home,
|
||||
is_root_path = is_root_path,
|
||||
openresty_args = openresty_args,
|
||||
pkg_cpath_org = pkg_cpath_org,
|
||||
pkg_path_org = pkg_path_org,
|
||||
min_etcd_version = min_etcd_version,
|
||||
}
|
||||
|
17
bin/apisix
17
bin/apisix
@ -17,7 +17,24 @@
|
||||
-- limitations under the License.
|
||||
--
|
||||
|
||||
local pkg_cpath_org = package.cpath
|
||||
local pkg_path_org = package.path
|
||||
|
||||
local apisix_home = "/usr/local/apisix"
|
||||
local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
|
||||
.. apisix_home .. "/deps/lib/lua/5.1/?.so;;"
|
||||
local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;"
|
||||
|
||||
-- modify the load path to load our dependencies
|
||||
package.cpath = pkg_cpath .. pkg_cpath_org
|
||||
package.path = pkg_path .. pkg_path_org
|
||||
|
||||
-- FIXME DELETE AFTER MERGE
|
||||
local env = require("apisix.cli.env")
|
||||
if type(env) == 'function' then
|
||||
-- the cached master one returns table instead of function
|
||||
env = env(apisix_home, pkg_cpath_org, pkg_path_org)
|
||||
end
|
||||
local util = require("apisix.cli.util")
|
||||
local ngx_tpl = require("apisix.cli.ngx_tpl")
|
||||
local yaml = require("tinyyaml")
|
||||
|
Loading…
Reference in New Issue
Block a user