tests: eliminated hitting Google's web servers (but we still make use of its public DNS servers).
This commit is contained in:
Родитель
2603780dd4
Коммит
0d12003313
|
@ -74,13 +74,13 @@ Hel
|
|||
location /read {
|
||||
content_by_lua '
|
||||
ngx.status = 302;
|
||||
ngx.header["Location"] = "http://google.com/foo";
|
||||
ngx.header["Location"] = "http://agentzh.org/foo";
|
||||
';
|
||||
}
|
||||
--- request
|
||||
GET /read
|
||||
--- response_headers
|
||||
Location: http://google.com/foo
|
||||
Location: http://agentzh.org/foo
|
||||
--- response_body
|
||||
--- error_code: 302
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ __DATA__
|
|||
--- config
|
||||
location /read {
|
||||
content_by_lua '
|
||||
ngx.redirect("http://google.com/foo");
|
||||
ngx.redirect("http://agentzh.org/foo");
|
||||
ngx.say("hi")
|
||||
';
|
||||
}
|
||||
--- request
|
||||
GET /read
|
||||
--- response_headers
|
||||
Location: http://google.com/foo
|
||||
Location: http://agentzh.org/foo
|
||||
--- response_body_like: 302 Found
|
||||
--- error_code: 302
|
||||
|
||||
|
@ -40,14 +40,14 @@ Location: http://google.com/foo
|
|||
--- config
|
||||
location /read {
|
||||
content_by_lua '
|
||||
ngx.redirect("http://google.com/foo", ngx.HTTP_MOVED_TEMPORARILY);
|
||||
ngx.redirect("http://agentzh.org/foo", ngx.HTTP_MOVED_TEMPORARILY);
|
||||
ngx.say("hi")
|
||||
';
|
||||
}
|
||||
--- request
|
||||
GET /read
|
||||
--- response_headers
|
||||
Location: http://google.com/foo
|
||||
Location: http://agentzh.org/foo
|
||||
--- response_body_like: 302 Found
|
||||
--- error_code: 302
|
||||
|
||||
|
@ -57,14 +57,14 @@ Location: http://google.com/foo
|
|||
--- config
|
||||
location /read {
|
||||
content_by_lua '
|
||||
ngx.redirect("http://google.com/foo", ngx.HTTP_MOVED_PERMANENTLY);
|
||||
ngx.redirect("http://agentzh.org/foo", ngx.HTTP_MOVED_PERMANENTLY);
|
||||
ngx.say("hi")
|
||||
';
|
||||
}
|
||||
--- request
|
||||
GET /read
|
||||
--- response_headers
|
||||
Location: http://google.com/foo
|
||||
Location: http://agentzh.org/foo
|
||||
--- response_body_like: 301 Moved Permanently
|
||||
--- error_code: 301
|
||||
|
||||
|
@ -74,7 +74,7 @@ Location: http://google.com/foo
|
|||
--- config
|
||||
location /read {
|
||||
content_by_lua '
|
||||
ngx.redirect("http://google.com/foo", 404);
|
||||
ngx.redirect("http://agentzh.org/foo", 404);
|
||||
ngx.say("hi")
|
||||
';
|
||||
}
|
||||
|
@ -131,14 +131,14 @@ GET /read
|
|||
--- config
|
||||
location /read {
|
||||
content_by_lua '
|
||||
ngx.redirect("http://google.com/foo?bar=3");
|
||||
ngx.redirect("http://agentzh.org/foo?bar=3");
|
||||
ngx.say("hi")
|
||||
';
|
||||
}
|
||||
--- request
|
||||
GET /read
|
||||
--- response_headers
|
||||
Location: http://google.com/foo?bar=3
|
||||
Location: http://agentzh.org/foo?bar=3
|
||||
--- response_body_like: 302 Found
|
||||
--- error_code: 302
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ bad things happen
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort on;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
|
||||
location = /sleep {
|
||||
|
@ -241,7 +241,7 @@ client prematurely closed connection
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort off;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
--- request
|
||||
GET /t
|
||||
|
|
|
@ -365,7 +365,7 @@ delete thread 1
|
|||
|
||||
--- timeout: 0.2
|
||||
--- abort
|
||||
--- wait: 0.2
|
||||
--- wait: 0.3
|
||||
--- ignore_response
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
|
|
@ -42,7 +42,7 @@ __DATA__
|
|||
location /t1 {
|
||||
rewrite_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("www.google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -75,7 +75,7 @@ lua tcp socket connect timed out
|
|||
rewrite_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(150)
|
||||
local ok, err = sock:connect("www.google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -110,7 +110,7 @@ lua tcp socket connect timeout: 150
|
|||
rewrite_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(nil)
|
||||
local ok, err = sock:connect("www.google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -145,7 +145,7 @@ lua tcp socket connect timeout: 102
|
|||
rewrite_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(0)
|
||||
local ok, err = sock:connect("www.google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -181,7 +181,7 @@ lua tcp socket connect timeout: 102
|
|||
rewrite_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(-1)
|
||||
local ok, err = sock:connect("www.google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
|
|
@ -309,12 +309,12 @@ exiting the user thread
|
|||
=== TEST 5: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.tcp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
resolver_timeout 12s;
|
||||
rewrite_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -322,7 +322,7 @@ exiting the user thread
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("www.google.com", 80)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -339,6 +339,14 @@ GET /lua
|
|||
|
||||
global timers
|
||||
|
||||
F(ngx_resolve_start) {
|
||||
println("resolver started")
|
||||
}
|
||||
|
||||
F(ngx_http_lua_socket_resolve_handler) {
|
||||
println("resolver done")
|
||||
}
|
||||
|
||||
F(ngx_http_free_request) {
|
||||
println("free request")
|
||||
}
|
||||
|
@ -348,7 +356,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -356,7 +364,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -369,7 +377,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -383,10 +391,11 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolver started
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua tcp resolve cleanup
|
||||
delete timer 12000
|
||||
|
@ -408,12 +417,13 @@ after
|
|||
=== TEST 6: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.udp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
#resolver 127.0.0.1;
|
||||
resolver_timeout 12s;
|
||||
rewrite_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -421,7 +431,7 @@ after
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.udp()
|
||||
local ok, err = sock:setpeername("www.google.com", 80)
|
||||
local ok, err = sock:setpeername("agentzh.org", 80)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -438,6 +448,14 @@ GET /lua
|
|||
|
||||
global timers
|
||||
|
||||
F(ngx_resolve_start) {
|
||||
println("resolver started")
|
||||
}
|
||||
|
||||
F(ngx_http_lua_socket_resolve_handler) {
|
||||
println("resolver done")
|
||||
}
|
||||
|
||||
F(ngx_http_free_request) {
|
||||
println("free request")
|
||||
}
|
||||
|
@ -447,7 +465,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -455,7 +473,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -468,7 +486,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -482,10 +500,11 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolver started
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua udp resolve cleanup
|
||||
delete timer 12000
|
||||
|
|
|
@ -200,7 +200,7 @@ bad things happen
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort on;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
|
||||
location = /sleep {
|
||||
|
@ -241,7 +241,7 @@ client prematurely closed connection
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort off;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
--- request
|
||||
GET /t
|
||||
|
|
|
@ -309,12 +309,12 @@ exiting the user thread
|
|||
=== TEST 5: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.tcp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
resolver_timeout 12s;
|
||||
access_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -322,7 +322,7 @@ exiting the user thread
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("www.google.com", 80)
|
||||
local ok, err = sock:connect("agentzh.org", 80)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -348,7 +348,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -383,10 +383,10 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua tcp resolve cleanup
|
||||
delete timer 12000
|
||||
|
@ -408,12 +408,12 @@ after
|
|||
=== TEST 6: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.udp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
resolver_timeout 12s;
|
||||
access_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -421,7 +421,7 @@ after
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.udp()
|
||||
local ok, err = sock:setpeername("www.google.com", 80)
|
||||
local ok, err = sock:setpeername("agentzh.org", 80)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -447,7 +447,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -482,10 +482,10 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua udp resolve cleanup
|
||||
delete timer 12000
|
||||
|
|
|
@ -357,7 +357,7 @@ done
|
|||
ngx.req.set_uri_args("hello")
|
||||
ngx.req.set_uri("/bar", true);
|
||||
';
|
||||
proxy_pass http://google.com:5678;
|
||||
proxy_pass http://agentzh.org:12345;
|
||||
}
|
||||
--- request
|
||||
GET /foo?world
|
||||
|
@ -496,7 +496,7 @@ HTTP/1.0 ca%20t=%25
|
|||
ngx.req.set_uri("/bar", true);
|
||||
ngx.exit(503)
|
||||
';
|
||||
proxy_pass http://google.com:5678;
|
||||
proxy_pass http://agentzh.org:12345;
|
||||
}
|
||||
--- request
|
||||
GET /foo?world
|
||||
|
|
|
@ -298,7 +298,7 @@ qr/connect\(\) failed \(\d+: Connection refused\)/
|
|||
location /test {
|
||||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("google.com", 16787)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
ngx.say("connect: ", ok, " ", err)
|
||||
|
||||
local bytes
|
||||
|
|
|
@ -47,7 +47,7 @@ __DATA__
|
|||
location /t {
|
||||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -75,7 +75,7 @@ lua tcp socket connect timed out
|
|||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(150)
|
||||
local ok, err = sock:connect("google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -103,7 +103,7 @@ lua tcp socket connect timed out
|
|||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(nil)
|
||||
local ok, err = sock:connect("google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -131,7 +131,7 @@ lua tcp socket connect timed out
|
|||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(0)
|
||||
local ok, err = sock:connect("google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -160,7 +160,7 @@ lua tcp socket connect timed out
|
|||
content_by_lua '
|
||||
local sock = ngx.socket.tcp()
|
||||
sock:settimeout(-1)
|
||||
local ok, err = sock:connect("google.com", 12345)
|
||||
local ok, err = sock:connect("agentzh.org", 12345)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
|
|
@ -297,12 +297,12 @@ exiting the user thread
|
|||
=== TEST 5: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.tcp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
resolver_timeout 12s;
|
||||
content_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -310,7 +310,7 @@ exiting the user thread
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.tcp()
|
||||
local ok, err = sock:connect("www.google.com", 80)
|
||||
local ok, err = sock:connect("agentzh.org", 80)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -335,7 +335,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -370,10 +370,10 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua tcp resolve cleanup
|
||||
delete timer 12000
|
||||
|
@ -393,12 +393,12 @@ after
|
|||
=== TEST 6: exit in user thread (entry thread is still pending on the DNS resolver for ngx.socket.udp)
|
||||
--- config
|
||||
location /lua {
|
||||
resolver www.google.com;
|
||||
resolver agentzh.org;
|
||||
resolver_timeout 12s;
|
||||
content_by_lua '
|
||||
function f()
|
||||
ngx.say("hello in thread")
|
||||
ngx.sleep(0.1)
|
||||
ngx.sleep(0.001)
|
||||
ngx.exit(0)
|
||||
end
|
||||
|
||||
|
@ -406,7 +406,7 @@ after
|
|||
ngx.thread.spawn(f)
|
||||
ngx.say("after")
|
||||
local sock = ngx.socket.udp()
|
||||
local ok, err = sock:setpeername("www.google.com", 80)
|
||||
local ok, err = sock:setpeername("agentzh.org", 80)
|
||||
if not ok then
|
||||
ngx.say("failed to connect: ", err)
|
||||
return
|
||||
|
@ -431,7 +431,7 @@ F(ngx_resolve_name) {
|
|||
}
|
||||
|
||||
M(timer-add) {
|
||||
if ($arg2 == 12000 || $arg2 == 100) {
|
||||
if ($arg2 == 12000 || $arg2 == 1) {
|
||||
timers[$arg1] = $arg2
|
||||
printf("add timer %d\n", $arg2)
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ M(timer-add) {
|
|||
|
||||
M(timer-del) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("delete timer %d\n", tm)
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ M(timer-del) {
|
|||
|
||||
M(timer-expire) {
|
||||
tm = timers[$arg1]
|
||||
if (tm == 12000 || tm == 100) {
|
||||
if (tm == 12000 || tm == 1) {
|
||||
printf("expire timer %d\n", timers[$arg1])
|
||||
delete timers[$arg1]
|
||||
}
|
||||
|
@ -466,10 +466,10 @@ _EOC_
|
|||
--- stap_out
|
||||
create 2 in 1
|
||||
spawn user thread 2 in 1
|
||||
add timer 100
|
||||
resolving www.google.com
|
||||
add timer 1
|
||||
resolving agentzh.org
|
||||
add timer 12000
|
||||
expire timer 100
|
||||
expire timer 1
|
||||
terminate 2: ok
|
||||
lua udp resolve cleanup
|
||||
delete timer 12000
|
||||
|
|
|
@ -196,7 +196,7 @@ bad things happen
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort on;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
|
||||
location = /sleep {
|
||||
|
@ -237,7 +237,7 @@ client prematurely closed connection
|
|||
|
||||
location = /sub {
|
||||
proxy_ignore_client_abort off;
|
||||
proxy_pass http://www.google.com:1234/;
|
||||
proxy_pass http://agentzh.org:12345/;
|
||||
}
|
||||
--- request
|
||||
GET /t
|
||||
|
|
Загрузка…
Ссылка в новой задаче