Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
idevz committed May 9, 2019
1 parent c18837d commit 57bd83a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/motan/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ local Motan = {

local init_env
init_env = function(default_env_setting)
local default_env_setting = default_env_setting or {}
local app_root = default_env_setting.APP_ROOT or os.getenv("APP_ROOT") or nil
local motan_env = default_env_setting.MOTAN_ENV or os.getenv("MOTAN_ENV") or "production"
assert(app_root ~= nil, "APP_ROOT should not be nil")
Expand Down
1 change: 1 addition & 0 deletions t/000-sanity.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ our $MOTAN_DEMO_PATH=$root_path . "/motan-demo/";

$ENV{TEST_NGINX_SERVER_PORT} = 1990;
$ENV{MOTAN_ENV} = "development";
$ENV{APP_ROOT} = $MOTAN_DEMO_PATH;
# $ENV{LUA_PACKAGE_PATH} ||= $MOTAN_DEMO_PATH . "/?.lua;" . $MOTAN_DEMO_PATH . "/?/init.lua;" . $MOTAN_P_ROOT . "/?.lua;" . $MOTAN_P_ROOT . "/?/init.lua;./?.lua;/?.lua;/?/init.lua";
log_level('warn');
#worker_connections(1014);
Expand Down
3 changes: 2 additions & 1 deletion t/002-concurrent_call.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ our $MOTAN_DEMO_PATH=$root_path . "/motan-demo/";

$ENV{TEST_NGINX_SERVER_PORT} = 1990;
$ENV{MOTAN_ENV} = "development";
$ENV{APP_ROOT} = $MOTAN_DEMO_PATH;
# $ENV{LUA_PACKAGE_PATH} ||= $MOTAN_DEMO_PATH . "/?.lua;" . $MOTAN_DEMO_PATH . "/?/init.lua;" . $MOTAN_P_ROOT . "/?.lua;" . $MOTAN_P_ROOT . "/?/init.lua;./?.lua;/?.lua;/?/init.lua";
log_level('warn');
#worker_connections(1014);
Expand Down Expand Up @@ -96,7 +97,7 @@ __DATA__
end
local ok, res_or_err = ngx.thread.wait(threads[run_time])
if not ok then
ngx.say("fail to run, err:" .. res_or_err)
ngx.say("fail to run, err:", res_or_err)
else
local check_rs = {}
for k, v in pairs(res_or_err) do
Expand Down
1 change: 1 addition & 0 deletions t/003-unpack_bug.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ our $MOTAN_DEMO_PATH=$root_path . "/motan-demo/";

$ENV{TEST_NGINX_SERVER_PORT} = 1990;
$ENV{MOTAN_ENV} = "development";
$ENV{APP_ROOT} = $MOTAN_DEMO_PATH;
# $ENV{LUA_PACKAGE_PATH} ||= $MOTAN_DEMO_PATH . "/?.lua;" . $MOTAN_DEMO_PATH . "/?/init.lua;" . $MOTAN_P_ROOT . "/?.lua;" . $MOTAN_P_ROOT . "/?/init.lua;./?.lua;/?.lua;/?/init.lua";
log_level('warn');
#worker_connections(1014);
Expand Down
1 change: 1 addition & 0 deletions t/004-simple-serialize.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _EOC_

$ENV{TEST_NGINX_SERVER_PORT} = 1990;
$ENV{MOTAN_ENV} = "development";
$ENV{APP_ROOT} = $MOTAN_DEMO_PATH;
log_level('warn');
#worker_connections(1014);
#master_on();
Expand Down
1 change: 1 addition & 0 deletions t/005-simple-deserialize.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _EOC_

$ENV{TEST_NGINX_SERVER_PORT} = 1990;
$ENV{MOTAN_ENV} = "development";
$ENV{APP_ROOT} = $MOTAN_DEMO_PATH;
log_level('warn');
#worker_connections(1014);
#master_on();
Expand Down
3 changes: 2 additions & 1 deletion t/motan-demo/motan-service/HelloWorldService.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function _M.Hello(self, p1, p2)
end

function _M.ConcurrentHello(self, p1, p2)
return self.metadata
ngx.log(ngx.ERR, "ConcurrentHello ===>", sprint_r({p1, p2}))
return motan_ctx().metadata
end

return _M

0 comments on commit 57bd83a

Please sign in to comment.