Skip to content

Commit cf88765

Browse files
committed
tests: switched to 127.0.0.2 instead of agentzh.org for timeout-related tests.
1 parent 01735c2 commit cf88765

18 files changed

+54
-52
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ before_script:
9696

9797
script:
9898
- sudo iptables -I OUTPUT 1 -p udp --dport 10086 -j REJECT
99+
- sudo iptables -A OUTPUT -p tcp --dst 127.0.0.2 --dport 12345 -j DROP
100+
- sudo iptables -A OUTPUT -p udp --dst 127.0.0.2 --dport 12345 -j DROP
99101
- cd luajit2/
100102
- make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT -msse4.2' > build.log 2>&1 || (cat build.log && exit 1)
101103
- sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)

t/023-rewrite/client-abort.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ bad things happen
199199
200200
location = /sub {
201201
proxy_ignore_client_abort on;
202-
proxy_pass http://agentzh.org:12345/;
202+
proxy_pass http://127.0.0.2:12345/;
203203
}
204204

205205
location = /sleep {
@@ -240,7 +240,7 @@ client prematurely closed connection
240240
241241
location = /sub {
242242
proxy_ignore_client_abort off;
243-
proxy_pass http://agentzh.org:12345/;
243+
proxy_pass http://127.0.0.2:12345/;
244244
}
245245
--- request
246246
GET /t

t/023-rewrite/tcp-socket-timeout.t

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ __DATA__
4646
location /t1 {
4747
rewrite_by_lua '
4848
local sock = ngx.socket.tcp()
49-
local ok, err = sock:connect("agentzh.org", 12345)
49+
local ok, err = sock:connect("127.0.0.2", 12345)
5050
if not ok then
5151
ngx.say("failed to connect: ", err)
5252
return
@@ -63,7 +63,7 @@ GET /t1
6363
failed to connect: timeout
6464
--- error_log
6565
lua tcp socket connect timeout: 100
66-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
66+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
6767
--- timeout: 10
6868

6969

@@ -79,7 +79,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
7979
rewrite_by_lua '
8080
local sock = ngx.socket.tcp()
8181
sock:settimeout(150)
82-
local ok, err = sock:connect("agentzh.org", 12345)
82+
local ok, err = sock:connect("127.0.0.2", 12345)
8383
if not ok then
8484
ngx.say("failed to connect: ", err)
8585
return
@@ -114,7 +114,7 @@ lua tcp socket connect timeout: 150
114114
rewrite_by_lua '
115115
local sock = ngx.socket.tcp()
116116
sock:settimeout(nil)
117-
local ok, err = sock:connect("agentzh.org", 12345)
117+
local ok, err = sock:connect("127.0.0.2", 12345)
118118
if not ok then
119119
ngx.say("failed to connect: ", err)
120120
return
@@ -149,7 +149,7 @@ lua tcp socket connect timeout: 102
149149
rewrite_by_lua '
150150
local sock = ngx.socket.tcp()
151151
sock:settimeout(0)
152-
local ok, err = sock:connect("agentzh.org", 12345)
152+
local ok, err = sock:connect("127.0.0.2", 12345)
153153
if not ok then
154154
ngx.say("failed to connect: ", err)
155155
return
@@ -185,7 +185,7 @@ lua tcp socket connect timeout: 102
185185
rewrite_by_lua '
186186
local sock = ngx.socket.tcp()
187187
sock:settimeout(-1)
188-
local ok, err = sock:connect("agentzh.org", 12345)
188+
local ok, err = sock:connect("127.0.0.2", 12345)
189189
if not ok then
190190
ngx.say("failed to connect: ", err)
191191
return

t/023-rewrite/tcp-socket.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ qr/connect\(\) failed \(\d+: Connection refused\)/
304304
location /test {
305305
rewrite_by_lua '
306306
local sock = ngx.socket.tcp()
307-
local ok, err = sock:connect("agentzh.org", 12345)
307+
local ok, err = sock:connect("127.0.0.2", 12345)
308308
ngx.say("connect: ", ok, " ", err)
309309
310310
local bytes
@@ -329,7 +329,7 @@ send: nil closed
329329
receive: nil closed
330330
close: nil closed
331331
--- error_log
332-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
332+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
333333
--- timeout: 10
334334
335335

t/023-rewrite/uthread-exit.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ exiting the user thread
311311
ngx.thread.spawn(f)
312312
ngx.say("after")
313313
local sock = ngx.socket.tcp()
314-
local ok, err = sock:connect("agentzh.org", 12345)
314+
local ok, err = sock:connect("127.0.0.2", 12345)
315315
if not ok then
316316
ngx.say("failed to connect: ", err)
317317
return
@@ -521,7 +521,7 @@ after
521521
ngx.say("after")
522522
local sock = ngx.socket.tcp()
523523
sock:settimeout(12000)
524-
local ok, err = sock:connect("172.105.207.225", 12345)
524+
local ok, err = sock:connect("127.0.0.2", 12345)
525525
if not ok then
526526
ngx.say("failed to connect: ", err)
527527
return

t/024-access/client-abort.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bad things happen
200200
201201
location = /sub {
202202
proxy_ignore_client_abort on;
203-
proxy_pass http://agentzh.org:12345/;
203+
proxy_pass http://127.0.0.2:12345/;
204204
}
205205

206206
location = /sleep {
@@ -241,7 +241,7 @@ client prematurely closed connection
241241
242242
location = /sub {
243243
proxy_ignore_client_abort off;
244-
proxy_pass http://agentzh.org:12345/;
244+
proxy_pass http://127.0.0.2:12345/;
245245
}
246246
--- request
247247
GET /t

t/024-access/uthread-exit.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ after
502502
ngx.say("after")
503503
local sock = ngx.socket.tcp()
504504
sock:settimeout(12000)
505-
local ok, err = sock:connect("172.105.207.225", 12345)
505+
local ok, err = sock:connect("127.0.0.2", 12345)
506506
if not ok then
507507
ngx.say("failed to connect: ", err)
508508
return

t/027-multi-capture.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ proxy_cache_path conf/cache levels=1:2 keys_zone=STATIC:10m inactive=10m max_siz
743743

744744
location = /proxy {
745745
proxy_cache STATIC;
746-
proxy_pass http://agentzh.org:12345;
746+
proxy_pass http://127.0.0.2:12345;
747747
proxy_cache_key $proxy_host$uri$args;
748748
proxy_cache_valid any 1s;
749749
#proxy_http_version 1.1;

t/030-uri-args.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ done
421421
ngx.req.set_uri_args("hello")
422422
ngx.req.set_uri("/bar", true);
423423
';
424-
proxy_pass http://agentzh.org:12345;
424+
proxy_pass http://127.0.0.2:12345;
425425
}
426426
--- request
427427
GET /foo?world
@@ -568,7 +568,7 @@ HTTP/1.0 ca%20t=%25
568568
ngx.req.set_uri("/bar", true);
569569
ngx.exit(503)
570570
';
571-
proxy_pass http://agentzh.org:12345;
571+
proxy_pass http://127.0.0.2:12345;
572572
}
573573
--- request
574574
GET /foo?world

t/058-tcp-socket.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ qr/connect\(\) failed \(\d+: Connection refused\)/
298298
location /test {
299299
content_by_lua '
300300
local sock = ngx.socket.tcp()
301-
local ok, err = sock:connect("agentzh.org", 12345)
301+
local ok, err = sock:connect("127.0.0.2", 12345)
302302
ngx.say("connect: ", ok, " ", err)
303303
304304
local bytes
@@ -321,7 +321,7 @@ send: nil closed
321321
receive: nil closed
322322
close: nil closed
323323
--- error_log
324-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
324+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
325325
--- timeout: 10
326326
327327
@@ -3315,7 +3315,7 @@ close: 1 nil
33153315
33163316
local thr = ngx.thread.spawn(function ()
33173317
sock = ngx.socket.tcp()
3318-
local ok, err = sock:connect("agentzh.org", 12345)
3318+
local ok, err = sock:connect("127.0.0.2", 12345)
33193319
if not ok then
33203320
ngx.say("failed to connect: ", err)
33213321
return

t/065-tcp-socket-timeout.t

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ __DATA__
5151
location /t {
5252
content_by_lua '
5353
local sock = ngx.socket.tcp()
54-
local ok, err = sock:connect("agentzh.org", 12345)
54+
local ok, err = sock:connect("127.0.0.2", 12345)
5555
if not ok then
5656
ngx.say("failed to connect: ", err)
5757
return
@@ -66,7 +66,7 @@ GET /t
6666
failed to connect: timeout
6767
--- error_log
6868
lua tcp socket connect timeout: 100
69-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
69+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
7070
--- timeout: 10
7171

7272

@@ -81,7 +81,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
8181
content_by_lua '
8282
local sock = ngx.socket.tcp()
8383
sock:settimeout(150)
84-
local ok, err = sock:connect("agentzh.org", 12345)
84+
local ok, err = sock:connect("127.0.0.2", 12345)
8585
if not ok then
8686
ngx.say("failed to connect: ", err)
8787
return
@@ -96,7 +96,7 @@ GET /t
9696
failed to connect: timeout
9797
--- error_log
9898
lua tcp socket connect timeout: 150
99-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
99+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
100100
--- timeout: 10
101101

102102

@@ -110,7 +110,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
110110
content_by_lua '
111111
local sock = ngx.socket.tcp()
112112
sock:settimeout(nil)
113-
local ok, err = sock:connect("agentzh.org", 12345)
113+
local ok, err = sock:connect("127.0.0.2", 12345)
114114
if not ok then
115115
ngx.say("failed to connect: ", err)
116116
return
@@ -125,7 +125,7 @@ GET /t
125125
failed to connect: timeout
126126
--- error_log
127127
lua tcp socket connect timeout: 102
128-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
128+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
129129

130130

131131

@@ -139,7 +139,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
139139
content_by_lua '
140140
local sock = ngx.socket.tcp()
141141
sock:settimeout(0)
142-
local ok, err = sock:connect("agentzh.org", 12345)
142+
local ok, err = sock:connect("127.0.0.2", 12345)
143143
if not ok then
144144
ngx.say("failed to connect: ", err)
145145
return
@@ -154,7 +154,7 @@ GET /t
154154
failed to connect: timeout
155155
--- error_log
156156
lua tcp socket connect timeout: 102
157-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
157+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
158158
--- timeout: 10
159159

160160

@@ -168,7 +168,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
168168
content_by_lua '
169169
local sock = ngx.socket.tcp()
170170
sock:settimeout(-1)
171-
local ok, err = sock:connect("agentzh.org", 12345)
171+
local ok, err = sock:connect("127.0.0.2", 12345)
172172
if not ok then
173173
ngx.say("failed to connect: ", err)
174174
return
@@ -683,7 +683,7 @@ after
683683
location /t {
684684
content_by_lua '
685685
local sock = ngx.socket.tcp()
686-
local ok, err = sock:connect("agentzh.org", 12345)
686+
local ok, err = sock:connect("127.0.0.2", 12345)
687687
if not ok then
688688
ngx.say("1: failed to connect: ", err)
689689
@@ -707,7 +707,7 @@ GET /t
707707
2: connected: 1
708708
--- error_log
709709
lua tcp socket connect timeout: 100
710-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
710+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
711711
--- timeout: 10
712712

713713

t/068-socket-keepalive.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ continue to handle cosocket
20052005
20062006
local sock = ngx.socket.tcp()
20072007
sock:settimeouts(100, 3000, 3000)
2008-
local ok, err = sock:connect("agentzh.org", 12345, opts)
2008+
local ok, err = sock:connect("127.0.0.2", 12345, opts)
20092009
if not ok then
20102010
ngx.say(err)
20112011
end
@@ -2610,7 +2610,7 @@ ok
26102610
local ok, err
26112611
if should_timeout then
26122612
sock:settimeouts(100, 3000, 3000)
2613-
ok, err = sock:connect("agentzh.org", 12345, opts)
2613+
ok, err = sock:connect("127.0.0.2", 12345, opts)
26142614
else
26152615
ok, err = sock:connect("127.0.0.1", port, opts)
26162616
end
@@ -2644,7 +2644,7 @@ lua tcp socket connect timed out, when connecting to
26442644
26452645
=== TEST 46: conn queuing: resume connect operation if resumed connect failed (could not be resolved)
26462646
--- config
2647-
resolver agentzh.org:12345 ipv6=off;
2647+
resolver 127.0.0.2:12345 ipv6=off;
26482648
resolver_timeout 1s;
26492649
location /t {
26502650
set $port $TEST_NGINX_MEMCACHED_PORT;
@@ -2658,7 +2658,7 @@ lua tcp socket connect timed out, when connecting to
26582658
local ok, err
26592659
if should_timeout then
26602660
sock:settimeouts(1, 3000, 3000)
2661-
ok, err = sock:connect("agentzh.org", 12345, opts)
2661+
ok, err = sock:connect("agentzh.org", 80, opts)
26622662
else
26632663
ok, err = sock:connect("127.0.0.1", port, opts)
26642664
end

t/090-log-socket-errors.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ __DATA__
2828
lua_socket_log_errors off;
2929
content_by_lua '
3030
local sock = ngx.socket.tcp()
31-
local ok, err = sock:connect("agentzh.org", 12345)
31+
local ok, err = sock:connect("127.0.0.2", 12345)
3232
ngx.say(err)
3333
';
3434
}
@@ -50,7 +50,7 @@ timeout
5050
lua_socket_log_errors on;
5151
content_by_lua '
5252
local sock = ngx.socket.tcp()
53-
local ok, err = sock:connect("agentzh.org", 12345)
53+
local ok, err = sock:connect("127.0.0.2", 12345)
5454
ngx.say(err)
5555
';
5656
}
@@ -59,7 +59,7 @@ GET /t
5959
--- response_body
6060
timeout
6161
--- error_log
62-
lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
62+
lua tcp socket connect timed out, when connecting to 127.0.0.2:12345
6363
6464
6565
@@ -72,7 +72,7 @@ lua tcp socket connect timed out, when connecting to 172.105.207.225:12345
7272
lua_socket_read_timeout 1ms;
7373
content_by_lua '
7474
local sock = ngx.socket.udp()
75-
local ok, err = sock:setpeername("agentzh.org", 12345)
75+
local ok, err = sock:setpeername("127.0.0.2", 12345)
7676
ok, err = sock:receive()
7777
ngx.say(err)
7878
';
@@ -95,7 +95,7 @@ lua udp socket read timed out
9595
lua_socket_read_timeout 1ms;
9696
content_by_lua '
9797
local sock = ngx.socket.udp()
98-
local ok, err = sock:setpeername("agentzh.org", 12345)
98+
local ok, err = sock:setpeername("127.0.0.2", 12345)
9999
ok, err = sock:receive()
100100
ngx.say(err)
101101
';

t/094-uthread-exit.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ after
501501
ngx.say("after")
502502
local sock = ngx.socket.tcp()
503503
sock:settimeout(12000)
504-
local ok, err = sock:connect("172.105.207.225", 12345)
504+
local ok, err = sock:connect("127.0.0.2", 12345)
505505
if not ok then
506506
ngx.say("failed to connect: ", err)
507507
return

0 commit comments

Comments
 (0)