test: also lint the test helpers (#2252)
Close #2215
diff --git a/t/lib/server.lua b/t/lib/server.lua
index 68ba81a..c9e89e9 100644
--- a/t/lib/server.lua
+++ b/t/lib/server.lua
@@ -154,7 +154,8 @@
ngx.exit(400)
end
- if span.localEndpoint.serviceName ~= 'APISIX' and span.localEndpoint.serviceName ~= 'apisix' then
+ if span.localEndpoint.serviceName ~= 'APISIX'
+ and span.localEndpoint.serviceName ~= 'apisix' then
ngx.exit(400)
end
@@ -205,7 +206,9 @@
local args = ngx.req.get_uri_args()
local resName = args.resName
if resName == '/hello' or resName == '/wolf/rbac/custom/headers' then
- ngx.say(json_encode({ok=true, data={ userInfo={nickname="administrator",username="admin", id="100"} }}))
+ ngx.say(json_encode({ok=true,
+ data={ userInfo={nickname="administrator",
+ username="admin", id="100"} }}))
else
ngx.status = 401
ngx.say(json_encode({ok=false, reason="no permission to access"}))
@@ -220,7 +223,8 @@
ngx.exit(0)
end
- ngx.say(json_encode({ok=true, data={ userInfo={nickname="administrator", username="admin", id="100"} }}))
+ ngx.say(json_encode({ok=true,
+ data={ userInfo={nickname="administrator", username="admin", id="100"} }}))
end
function _M.wolf_rbac_change_pwd()
@@ -237,7 +241,8 @@
function _M.wolf_rbac_custom_headers()
local headers = ngx.req.get_headers()
- ngx.say('id:' .. headers['X-UserId'] .. ',username:' .. headers['X-Username'] .. ',nickname:' .. headers['X-Nickname'])
+ ngx.say('id:' .. headers['X-UserId'] .. ',username:' .. headers['X-Username']
+ .. ',nickname:' .. headers['X-Nickname'])
end
function _M.websocket_handshake()
diff --git a/t/lib/test_admin.lua b/t/lib/test_admin.lua
index dc245c3..ac6d22e 100644
--- a/t/lib/test_admin.lua
+++ b/t/lib/test_admin.lua
@@ -16,6 +16,7 @@
--
local http = require("resty.http")
local json = require("cjson.safe")
+local core = require("apisix.core")
local aes = require "resty.aes"
local ngx_encode_base64 = ngx.encode_base64
local str_find = string.find
diff --git a/utils/check-lua-code-style.sh b/utils/check-lua-code-style.sh
index 6cb80d3..2dfff59 100755
--- a/utils/check-lua-code-style.sh
+++ b/utils/check-lua-code-style.sh
@@ -19,7 +19,7 @@
set -ex
-luacheck -q apisix
+luacheck -q apisix t/lib
find apisix -name '*.lua' -exec ./utils/lj-releng {} + > \
/tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1)