Skip to content

Commit

Permalink
tests: avoided using a local listening port to avoid running out of a…
Browse files Browse the repository at this point in the history
…ddresses in the "check leak" test mode.
  • Loading branch information
agentzh committed Oct 28, 2017
1 parent 572bf4c commit f02da03
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions t/023-preread/tcp-socket.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ our $HtmlDir = html_dir;

$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
$ENV{TEST_NGINX_RESOLVER} ||= '8.8.8.8';
$ENV{TEST_NGINX_HTML_DIR} ||= html_dir();

#log_level 'warn';

Expand All @@ -21,33 +22,32 @@ __DATA__
=== TEST 1: sanity
--- stream_config
server {
listen 127.0.0.1:9988;
listen unix:$TEST_NGINX_HTML_DIR/nginx.sock;

return testing\npreread\n;
}

--- stream_server_config
preread_by_lua_block {
local sock = ngx.socket.tcp()
local port = 9988
local ok, err = sock:connect("127.0.0.1", port)
local ok, err = sock:connect("unix:$TEST_NGINX_HTML_DIR/nginx.sock")
if not ok then
ngx.say("failed to connect: ", err)
return
end

ngx.say("connected: ", ok)

local req = "GET /foo HTTP/1.0\r\nHost: localhost\r\nConnection: close\r\n\r\n"
-- req = "OK"
local req = "GET /foo HTTP/1.0\r\nHost: localhost\r\nConnection: close\r\n\r\n"
-- req = "OK"

local bytes, err = sock:send(req)
if not bytes then
ngx.say("failed to send request: ", err)
return
end
local bytes, err = sock:send(req)
if not bytes then
ngx.say("failed to send request: ", err)
return
end

ngx.say("request sent: ", bytes)
ngx.say("request sent: ", bytes)

while true do
local line, err, part = sock:receive()
Expand Down

0 comments on commit f02da03

Please sign in to comment.