-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
udp unit tests added
- Loading branch information
alonbg
committed
Aug 1, 2016
1 parent
ca6a928
commit 281e2fa
Showing
7 changed files
with
850 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ ngx: 56 | |
ngx.say("n = ", n) | ||
} | ||
--- stream_response | ||
n = 1 | ||
n = 2 | ||
--- no_error_log | ||
[error] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# vim:set ft= ts=4 sw=4 et fdm=marker: | ||
use Test::Nginx::Socket::Lua::Dgram; | ||
|
||
#worker_connections(1014); | ||
#master_on(); | ||
#workers(4); | ||
#log_level('warn'); | ||
no_root_location(); | ||
|
||
#repeat_each(2); | ||
|
||
plan tests => repeat_each() * (blocks() * 3); | ||
|
||
our $HtmlDir = html_dir; | ||
|
||
#$ENV{LUA_CPATH} = "/usr/local/openresty/lualib/?.so;" . $ENV{LUA_CPATH}; | ||
|
||
no_long_string(); | ||
run_tests(); | ||
|
||
__DATA__ | ||
|
||
|
||
=== TEST 1: entries under ngx._udp_meta | ||
--- SKIP | ||
--- dgram_server_config | ||
content_by_lua_block { | ||
local n = 0 | ||
for k, v in pairs(ngx._udp_meta) do | ||
n = n + 1 | ||
end | ||
ngx.say("n = ", n) | ||
} | ||
--- dgram_response | ||
n = 5 | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
|
||
=== TEST 2: entries under the metatable of req sockets | ||
--- dgram_server_config | ||
content_by_lua_block { | ||
local n = 0 | ||
local sock, err = ngx.req.udp_socket() | ||
if not sock then | ||
ngx.say("failed to get the request socket: ", err) | ||
end | ||
|
||
for k, v in pairs(getmetatable(sock)) do | ||
print("key: ", k) | ||
n = n + 1 | ||
end | ||
assert(ngx.say("n = ", n)) | ||
} | ||
--- dgram_response | ||
n = 3 | ||
--- no_error_log | ||
[error] |
Oops, something went wrong.