summaryrefslogtreecommitdiff
path: root/ngx_stream_lua-0.0.16/t/023-preread/exit.t
blob: 09cbded8666f34f08f78c0deb17e720e4735f986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# vim:set ft= ts=4 sw=4 et fdm=marker:

use Test::Nginx::Socket::Lua::Stream;
#repeat_each(20000);

repeat_each(2);

#master_on();
#workers(1);
#log_level('debug');
#log_level('warn');
#worker_connections(1024);

plan tests => repeat_each() * (blocks() * 2);

$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
$ENV{TEST_NGINX_MYSQL_PORT} ||= 3306;

our $LuaCpath = $ENV{LUA_CPATH} ||
    '/usr/local/openresty-debug/lualib/?.so;/usr/local/openresty/lualib/?.so;;';

#$ENV{LUA_PATH} = $ENV{HOME} . '/work/JSON4Lua-0.9.30/json/?.lua';

no_long_string();
#no_shuffle();

run_tests();

__DATA__

=== TEST 1: throw 500
--- stream_server_config
    preread_by_lua_block { ngx.exit(500);ngx.say('hi') }
    content_by_lua_block { ngx.exit(ngx.OK) }
--- error_log
finalize stream request: 500



=== TEST 2: throw 0
--- stream_server_config
    preread_by_lua_block { ngx.say('Hi'); ngx.eof(); ngx.exit(0);ngx.say('world') }
    content_by_lua_block { ngx.exit(ngx.OK) }
--- stream_response
Hi