Skip to content
Browse files

added tests for the various "lua socket blah blah timed out" error me…

…ssages; also tweaked other cosocket test cases for different test modes.
  • Loading branch information...
1 parent f95c55f commit 1bce88568d5c41cd23cc55ba704e51680cca304c @agentzh agentzh committed Feb 17, 2012
Showing with 55 additions and 41 deletions.
  1. +5 −5 t/058-tcp-socket.t
  2. +46 −31 t/065-tcp-socket-timeout.t
  3. +1 −1 t/067-req-socket.t
  4. +3 −4 t/068-socket-keepalive.t
View
10 t/058-tcp-socket.t
@@ -5,7 +5,7 @@ use Test::Nginx::Socket;
repeat_each(2);
-plan tests => repeat_each() * (blocks() * 2 + 6);
+plan tests => repeat_each() * (blocks() * 2 + 8);
our $HtmlDir = html_dir;
@@ -345,7 +345,7 @@ connected: 1
--- config
server_tokens off;
resolver $TEST_NGINX_RESOLVER;
- resolver_timeout 1s;
+ resolver_timeout 2s;
location /t {
content_by_lua '
local sock = ngx.socket.tcp()
@@ -1763,7 +1763,7 @@ subrequest: 200, OK\r
local sock = ngx.socket.tcp()
local port = ngx.var.port
- sock:settimeout(200)
+ sock:settimeout(300)
local ok, err = sock:connect("127.0.0.1", port)
if not ok then
@@ -1836,7 +1836,7 @@ close: 1 nil
local sock = ngx.socket.tcp()
local port = ngx.var.port
- sock:settimeout(200)
+ sock:settimeout(300)
local ok, err = sock:connect("127.0.0.1", port)
if not ok then
@@ -1891,7 +1891,7 @@ close: 1 nil
local sock = ngx.socket.tcp()
local port = ngx.var.port
- sock:settimeout(200)
+ sock:settimeout(300)
local ok, err = sock:connect("127.0.0.1", port)
if not ok then
View
77 t/065-tcp-socket-timeout.t
@@ -18,7 +18,7 @@ use Test::Nginx::Socket;
repeat_each(2);
-plan tests => repeat_each() * (blocks() * 3 + 10);
+plan tests => repeat_each() * (blocks() * 4 + 10);
our $HtmlDir = html_dir;
@@ -55,6 +55,7 @@ GET /t
failed to connect: timeout
--- error_log
lua socket connect timeout: 100
+lua socket connect timed out
@@ -82,6 +83,7 @@ GET /t
failed to connect: timeout
--- error_log
lua socket connect timeout: 150
+lua socket connect timed out
@@ -109,6 +111,7 @@ GET /t
failed to connect: timeout
--- error_log
lua socket connect timeout: 102
+lua socket connect timed out
@@ -136,6 +139,7 @@ GET /t
failed to connect: timeout
--- error_log
lua socket connect timeout: 102
+lua socket connect timed out
@@ -163,6 +167,7 @@ GET /t
failed to connect: timeout
--- error_log
lua socket connect timeout: 102
+lua socket connect timed out
@@ -196,9 +201,10 @@ GET /t
--- response_body
connected: 1
failed to receive: timeout
---- error_log eval
-["lua socket read timeout: 100",
-"lua socket connect timeout: 60000"]
+--- error_log
+lua socket read timeout: 100
+lua socket connect timeout: 60000
+lua socket read timed out
@@ -234,9 +240,10 @@ GET /t
--- response_body
connected: 1
failed to receive: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket read timeout: 150"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket read timeout: 150
+lua socket read timed out
@@ -272,9 +279,10 @@ GET /t
--- response_body
connected: 1
failed to receive: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket read timeout: 102"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket read timeout: 102
+lua socket read timed out
@@ -311,9 +319,10 @@ GET /t
--- response_body
connected: 1
failed to receive: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket read timeout: 102"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket read timeout: 102
+lua socket read timed out
@@ -349,9 +358,10 @@ GET /t
--- response_body
connected: 1
failed to receive: timeout
---- error_log eval
-["lua socket read timeout: 102",
-"lua socket connect timeout: 60000"]
+--- error_log
+lua socket read timeout: 102
+lua socket connect timeout: 60000
+lua socket read timed out
@@ -385,9 +395,10 @@ GET /t
--- response_body
connected: 1
failed to send: timeout
---- error_log eval
-["lua socket send timeout: 100",
-"lua socket connect timeout: 60000"]
+--- error_log
+lua socket send timeout: 100
+lua socket connect timeout: 60000
+lua socket write timed out
@@ -423,9 +434,10 @@ GET /t
--- response_body
connected: 1
failed to send: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket send timeout: 150"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket send timeout: 150
+lua socket write timed out
@@ -461,9 +473,10 @@ GET /t
--- response_body
connected: 1
failed to send: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket send timeout: 102"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket send timeout: 102
+lua socket write timed out
@@ -499,9 +512,10 @@ GET /t
--- response_body
connected: 1
failed to send: timeout
---- error_log eval
-["lua socket connect timeout: 60000",
-"lua socket send timeout: 102"]
+--- error_log
+lua socket connect timeout: 60000
+lua socket send timeout: 102
+lua socket write timed out
@@ -537,7 +551,8 @@ GET /t
--- response_body
connected: 1
failed to send: timeout
---- error_log eval
-["lua socket send timeout: 102",
-"lua socket connect timeout: 60000"]
+--- error_log
+lua socket send timeout: 102
+lua socket connect timeout: 60000
+lua socket write timed out
View
2 t/067-req-socket.t
@@ -363,5 +363,5 @@ hello world
|failed to receive: closed [d]
)?done
--- no_error_log
-[error]
+[alert]
View
7 t/068-socket-keepalive.t
@@ -82,10 +82,9 @@ received: OK
["[error]",
"lua socket keepalive: free connection pool for "]
--- error_log eval
-[
-'lua socket get keepalive peer: using connection',
-'lua socket keepalive create connection pool for key "127.0.0.1:11211"',
-]
+qq{lua socket get keepalive peer: using connection
+lua socket keepalive create connection pool for key "127.0.0.1:$ENV{TEST_NGINX_MEMCACHED_PORT}"
+}

0 comments on commit 1bce885

Please sign in to comment.
Something went wrong with that request. Please try again.