test: make CI pass again (#2619)

This commit is contained in:
罗泽轩 2020-11-04 15:45:27 +08:00 committed by GitHub
parent 61cd91440b
commit 366d5040cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 51 deletions

View File

@ -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

View File

@ -15,6 +15,7 @@
-- limitations under the License.
--
local require = require
local util = require("apisix.cli.util")
local pcall = pcall
@ -22,15 +23,11 @@ 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;;"
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]
@ -44,15 +41,15 @@ if script_path:sub(1, 2) == './' then
is_root_path = true
end
pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
.. apisix_home .. "/deps/lib/lua/5.1/?.so;"
pkg_path = apisix_home .. "/?/init.lua;"
local 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
package.cpath = pkg_cpath .. package.cpath
package.path = pkg_path .. package.path
end
do
-- skip luajit environment
@ -71,6 +68,7 @@ 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,
@ -80,3 +78,4 @@ return {
pkg_path_org = pkg_path_org,
min_etcd_version = min_etcd_version,
}
end

View File

@ -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")