Skip to content

Commit c2565fe

Browse files
zhuizhuhaomengagentzh
authored andcommitted
tests: added test cases for sending HUP signal to nginx processes without the master process.
Signed-off-by: Yichun Zhang (agentzh) <[email protected]>
1 parent aa548f5 commit c2565fe

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

t/163-signal.t

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# vi:ft=
2+
3+
use Test::Nginx::Socket::Lua;
4+
5+
plan tests => 2 * blocks();
6+
7+
no_long_string();
8+
9+
10+
run_tests();
11+
12+
__DATA__
13+
14+
=== TEST 1: SIGHUP followed by SIGQUIT
15+
--- config
16+
location = /t {
17+
content_by_lua_block {
18+
local pid = ngx.worker.pid()
19+
os.execute("kill -HUP " .. pid)
20+
ngx.sleep(0.01)
21+
22+
os.execute("kill -QUIT " .. pid)
23+
}
24+
}
25+
--- request
26+
GET /t
27+
--- ignore_response
28+
--- wait: 0.1
29+
--- error_log eval
30+
qr/\[notice\] \d+#\d+: exit$/
31+
--- no_error_log eval
32+
qr/\[notice\] \d+#\d+: reconfiguring/
33+
34+
35+
36+
=== TEST 2: exit after receiving SIGHUP in single process mode
37+
--- config
38+
location = /t {
39+
content_by_lua_block {
40+
local pid = ngx.worker.pid()
41+
os.execute("kill -HUP " .. pid)
42+
}
43+
}
44+
--- request
45+
GET /t
46+
--- ignore_response
47+
--- wait: 0.1
48+
--- error_log eval
49+
qr/\[notice\] \d+#\d+: exit$/
50+
--- no_error_log eval
51+
qr/\[notice\] \d+#\d+: reconfiguring/

0 commit comments

Comments
 (0)