-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngx.process.master_pid #158
Changes from all commits
2ba0da9
168e6a0
bb7e723
b831619
390be52
91dc998
a74fdb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# vim:set ft= ts=4 sw=4 et fdm=marker: | ||
use lib 'lib'; | ||
use Test::Nginx::Socket::Lua; | ||
use Cwd qw(cwd); | ||
|
||
#worker_connections(1014); | ||
#master_process_enabled(1); | ||
#log_level('warn'); | ||
|
||
repeat_each(2); | ||
|
||
plan tests => repeat_each() * (blocks() * 6); | ||
|
||
my $pwd = cwd(); | ||
|
||
our $HttpConfig = <<_EOC_; | ||
lua_shared_dict dogs 1m; | ||
lua_package_path "$pwd/lib/?.lua;../lua-resty-lrucache/lib/?.lua;;"; | ||
init_by_lua_block { | ||
local verbose = false | ||
if verbose then | ||
local dump = require "jit.dump" | ||
dump.on("b", "$Test::Nginx::Util::ErrLogFile") | ||
else | ||
local v = require "jit.v" | ||
v.on("$Test::Nginx::Util::ErrLogFile") | ||
end | ||
|
||
require "resty.core" | ||
-- jit.off() | ||
} | ||
_EOC_ | ||
|
||
#no_diff(); | ||
#no_long_string(); | ||
check_accum_error_log(); | ||
run_tests(); | ||
|
||
__DATA__ | ||
|
||
=== TEST 1: ngx.process.master_pid | ||
--- http_config eval: $::HttpConfig | ||
--- config | ||
location = /t { | ||
content_by_lua_block { | ||
local process = require "ngx.process" | ||
|
||
local v | ||
local pid = process.master_pid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely wrong. You missed a pair of parentheses after This is another reason why you should make your PR pass the travis ci checks as @membphis suggested ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm not familar with travis ci, I will try to correct it ,thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here is not an error ,because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chronolaw I see, but the |
||
for i = 1, 400 do | ||
v = pid() | ||
end | ||
|
||
local f = io.open(ngx.config.prefix().."/logs/nginx.pid", "r") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style: needs spaces around binary operators like Also, |
||
if not f then | ||
ngx.say(false) | ||
else | ||
local str = f:read("*l") | ||
ngx.say(v == tonumber(str or "0")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the sake of debugging test failures, I think we should also output the actual master pid in the |
||
f:close() | ||
end | ||
ngx.say(v) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body_like chop | ||
^true | ||
\d+$ | ||
--- error_log eval | ||
qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):\d loop\]/ | ||
--- no_error_log | ||
[error] | ||
-- NYI: | ||
stitch | ||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not put extra blank lines at the end of the https://github.com/openresty/openresty-devel-utils/blob/master/reindex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add the following line here to enable nginx master process:
The test scaffold does not turn on nginx master process by default. Without this line, this test file fails on my side: