Skip to content

Commit 07c2f3f

Browse files
committed
tests: pipe.t: checked proc:wait() return value when timed out.
1 parent a11accb commit 07c2f3f

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ install:
6060
- git clone https://github.com/openresty/openresty.git ../openresty
6161
- git clone https://github.com/openresty/openresty-devel-utils.git
6262
- git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module
63-
- git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module
63+
- git clone -b proc_wait_timeout_fix https://github.com/spacewander/lua-nginx-module.git ../lua-nginx-module
6464
- git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
6565
- git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module
6666
- git clone https://github.com/openresty/lua-resty-lrucache.git

t/pipe.t

+32-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use t::TestCore;
44

55
repeat_each(2);
66

7-
plan tests => repeat_each() * (blocks() * 3 + 16);
7+
plan tests => repeat_each() * (blocks() * 3 + 17);
88

99
add_block_preprocessor(sub {
1010
my $block = shift;
@@ -1462,3 +1462,34 @@ ok
14621462
qr/\[notice\] .* signal \d+ \(SIGCHLD\) received from \d+/
14631463
--- no_error_log
14641464
[error]
1465+
1466+
1467+
1468+
=== TEST 42: return nil plus string 'timeout' when waiting process timed out
1469+
--- config
1470+
location = /t {
1471+
content_by_lua_block {
1472+
local ngx_pipe = require "ngx.pipe"
1473+
local proc, err = ngx_pipe.spawn({"sleep", "10s"})
1474+
if not proc then
1475+
ngx.say(err)
1476+
return
1477+
end
1478+
1479+
proc:set_timeouts(nil, nil, nil, 10)
1480+
local ok, err = proc:wait()
1481+
if not ok then
1482+
ngx.say(ok)
1483+
ngx.say(err)
1484+
else
1485+
ngx.say("ok")
1486+
end
1487+
}
1488+
}
1489+
--- response_body
1490+
nil
1491+
timeout
1492+
--- no_error_log
1493+
[error]
1494+
--- error_log
1495+
lua pipe wait process:

0 commit comments

Comments
 (0)