Skip to content

Commit e87a889

Browse files
committed
tests: disabled IPv6 in resolver.
1 parent 049d7a6 commit e87a889

File tree

8 files changed

+62
-61
lines changed

8 files changed

+62
-61
lines changed

t/058-tcp-socket.t

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ attempt to send data on a closed socket:
178178
=== TEST 4: with resolver
179179
--- timeout: 10
180180
--- stream_server_config
181-
lua_resolver $TEST_NGINX_RESOLVER;
181+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
182182
lua_resolver_timeout 3s;
183183
content_by_lua_block {
184184
local sock = ngx.socket.tcp()
@@ -260,7 +260,7 @@ qr/connect\(\) failed \(\d+: Connection refused\)/
260260

261261
=== TEST 6: connection timeout (tcp)
262262
--- stream_server_config
263-
lua_resolver $TEST_NGINX_RESOLVER;
263+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
264264
#lua_socket_connect_timeout 100ms;
265265
#lua_socket_send_timeout 100ms;
266266
#lua_socket_read_timeout 100ms;
@@ -316,7 +316,7 @@ connected: 1
316316

317317
=== TEST 8: resolver error (host not found)
318318
--- stream_server_config
319-
lua_resolver $TEST_NGINX_RESOLVER;
319+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
320320
lua_resolver_timeout 3s;
321321
content_by_lua_block {
322322
local sock = ngx.socket.tcp()
@@ -352,7 +352,7 @@ attempt to send data on a closed socket
352352

353353
=== TEST 9: resolver error (timeout)
354354
--- stream_server_config
355-
lua_resolver $TEST_NGINX_RESOLVER;
355+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
356356
lua_resolver_timeout 1ms;
357357
content_by_lua_block {
358358
local sock = ngx.socket.tcp()
@@ -1753,7 +1753,7 @@ close: nil closed
17531753
=== TEST 33: reread after a read time out happen (receive -> receive)
17541754
--- stream_server_config
17551755
lua_socket_read_timeout 100ms;
1756-
lua_resolver $TEST_NGINX_RESOLVER;
1756+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
17571757
content_by_lua_block {
17581758
local sock = ngx.socket.tcp()
17591759
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_MEMCACHED_PORT)
@@ -1790,7 +1790,7 @@ lua tcp socket read timed out
17901790

17911791
=== TEST 34: successful reread after a read time out happen (receive -> receive)
17921792
--- stream_server_config
1793-
lua_resolver $TEST_NGINX_RESOLVER;
1793+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
17941794
content_by_lua_block {
17951795
local sock = ngx.socket.tcp()
17961796
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_SERVER_PORT)
@@ -1863,7 +1863,7 @@ lua tcp socket read timed out
18631863
18641864
=== TEST 35: successful reread after a read time out happen (receive -> receiveuntil)
18651865
--- stream_server_config
1866-
lua_resolver $TEST_NGINX_RESOLVER;
1866+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
18671867
content_by_lua_block {
18681868
local sock = ngx.socket.tcp()
18691869
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_SERVER_PORT)
@@ -1940,7 +1940,7 @@ lua tcp socket read timed out
19401940

19411941
=== TEST 36: successful reread after a read time out happen (receiveuntil -> receiveuntil)
19421942
--- stream_server_config
1943-
lua_resolver $TEST_NGINX_RESOLVER;
1943+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
19441944
content_by_lua_block {
19451945
local sock = ngx.socket.tcp()
19461946
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_SERVER_PORT)
@@ -2019,7 +2019,7 @@ lua tcp socket read timed out
20192019
20202020
=== TEST 37: successful reread after a read time out happen (receiveuntil -> receive)
20212021
--- stream_server_config
2022-
lua_resolver $TEST_NGINX_RESOLVER;
2022+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
20232023
content_by_lua_block {
20242024
local sock = ngx.socket.tcp()
20252025
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_SERVER_PORT)
@@ -2528,7 +2528,7 @@ qr/runtime error: content_by_lua_block\(nginx\.conf:\d+\):14: bad request/
25282528
=== TEST 47: cosocket resolving aborted by coroutine yielding failures (require)
25292529
--- stream_config
25302530
lua_package_path "$prefix/html/?.lua;;";
2531-
lua_resolver $TEST_NGINX_RESOLVER;
2531+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
25322532

25332533
--- stream_server_config
25342534
content_by_lua_block {
@@ -2557,7 +2557,7 @@ runtime error: attempt to yield across C-call boundary
25572557
=== TEST 48: cosocket resolving aborted by coroutine yielding failures (xpcall err)
25582558
--- stream_config
25592559
lua_package_path "$prefix/html/?.lua;;";
2560-
lua_resolver $TEST_NGINX_RESOLVER;
2560+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
25612561

25622562
--- stream_server_config
25632563
content_by_lua_block {
@@ -2790,7 +2790,7 @@ close: 1 nil
27902790
=== TEST 52: kill a thread with a connecting socket
27912791
--- stream_server_config
27922792
lua_socket_connect_timeout 1s;
2793-
lua_resolver $TEST_NGINX_RESOLVER;
2793+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
27942794
lua_resolver_timeout 3s;
27952795

27962796
content_by_lua_block {

t/065-tcp-socket-timeout.t

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ __DATA__
4545
=== TEST 1: lua_socket_connect_timeout only
4646
--- stream_server_config
4747
lua_socket_connect_timeout 100ms;
48-
lua_resolver $TEST_NGINX_RESOLVER;
48+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
4949
lua_resolver_timeout 3s;
5050
content_by_lua_block {
5151
local sock = ngx.socket.tcp()
@@ -69,7 +69,7 @@ lua tcp socket connect timed out
6969
=== TEST 2: sock:settimeout() overrides lua_socket_connect_timeout
7070
--- stream_server_config
7171
lua_socket_connect_timeout 60s;
72-
lua_resolver $TEST_NGINX_RESOLVER;
72+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
7373
lua_resolver_timeout 3s;
7474
content_by_lua_block {
7575
local sock = ngx.socket.tcp()
@@ -94,7 +94,7 @@ lua tcp socket connect timed out
9494
=== TEST 3: sock:settimeout(nil) does not override lua_socket_connect_timeout
9595
--- stream_server_config
9696
lua_socket_connect_timeout 102ms;
97-
lua_resolver $TEST_NGINX_RESOLVER;
97+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
9898
content_by_lua_block {
9999
local sock = ngx.socket.tcp()
100100
sock:settimeout(nil)
@@ -117,7 +117,7 @@ lua tcp socket connect timed out
117117
=== TEST 4: sock:settimeout(0) does not override lua_socket_connect_timeout
118118
--- stream_server_config
119119
lua_socket_connect_timeout 102ms;
120-
lua_resolver $TEST_NGINX_RESOLVER;
120+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
121121
lua_resolver_timeout 3s;
122122
content_by_lua_block {
123123
local sock = ngx.socket.tcp()
@@ -142,7 +142,7 @@ lua tcp socket connect timed out
142142
=== TEST 5: sock:settimeout(-1) does not override lua_socket_connect_timeout
143143
--- stream_server_config
144144
lua_socket_connect_timeout 102ms;
145-
lua_resolver $TEST_NGINX_RESOLVER;
145+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
146146
content_by_lua_block {
147147
local sock = ngx.socket.tcp()
148148
sock:settimeout(-1)
@@ -165,7 +165,7 @@ lua tcp socket connect timed out
165165
=== TEST 6: lua_socket_read_timeout only
166166
--- stream_server_config
167167
lua_socket_read_timeout 100ms;
168-
lua_resolver $TEST_NGINX_RESOLVER;
168+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
169169
content_by_lua_block {
170170
local sock = ngx.socket.tcp()
171171
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_MEMCACHED_PORT)
@@ -597,7 +597,7 @@ after
597597
=== TEST 17: re-connect after timed out
598598
--- stream_server_config
599599
lua_socket_connect_timeout 100ms;
600-
lua_resolver $TEST_NGINX_RESOLVER;
600+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
601601
lua_resolver_timeout 3s;
602602
content_by_lua_block {
603603
local sock = ngx.socket.tcp()
@@ -630,7 +630,7 @@ lua tcp socket connect timed out
630630
=== TEST 18: re-send on the same object after a send timeout happens
631631
--- stream_server_config
632632
#lua_socket_send_timeout 100ms;
633-
lua_resolver $TEST_NGINX_RESOLVER;
633+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
634634
content_by_lua_block {
635635
local sock = ngx.socket.tcp()
636636
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_MEMCACHED_PORT)
@@ -729,7 +729,7 @@ lua tcp socket write timed out
729729

730730
=== TEST 20: abort when downstream socket pending on writes
731731
--- stream_server_config
732-
lua_resolver $TEST_NGINX_RESOLVER;
732+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
733733
#lua_lingering_timeout 10ms;
734734

735735
content_by_lua_block {
@@ -783,7 +783,7 @@ lua tcp socket write timed out
783783
=== TEST 21: read timeout on receive(N)
784784
--- stream_server_config
785785
lua_socket_read_timeout 100ms;
786-
lua_resolver $TEST_NGINX_RESOLVER;
786+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
787787
content_by_lua_block {
788788
local sock = ngx.socket.tcp()
789789
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_MEMCACHED_PORT)

t/090-log-socket-errors.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ __DATA__
1919
2020
=== TEST 1: log socket errors off (tcp)
2121
--- stream_server_config
22-
lua_resolver $TEST_NGINX_RESOLVER;
22+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
2323
lua_socket_connect_timeout 1ms;
2424
lua_socket_log_errors off;
2525
content_by_lua_block {
@@ -38,7 +38,7 @@ timeout
3838
3939
=== TEST 2: log socket errors on (tcp)
4040
--- stream_server_config
41-
lua_resolver $TEST_NGINX_RESOLVER;
41+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
4242
lua_socket_connect_timeout 1ms;
4343
lua_socket_log_errors on;
4444
content_by_lua_block {
@@ -57,7 +57,7 @@ lua tcp socket connect timed out
5757
5858
=== TEST 3: log socket errors on (udp)
5959
--- stream_server_config
60-
lua_resolver $TEST_NGINX_RESOLVER;
60+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
6161
lua_socket_log_errors on;
6262
lua_socket_read_timeout 1ms;
6363
content_by_lua_block {
@@ -77,7 +77,7 @@ lua udp socket read timed out
7777
7878
=== TEST 4: log socket errors off (udp)
7979
--- stream_server_config
80-
lua_resolver $TEST_NGINX_RESOLVER;
80+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
8181
lua_socket_log_errors off;
8282
lua_socket_read_timeout 1ms;
8383
content_by_lua_block {

t/091-coroutine.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ cc3: 2
156156
157157
=== TEST 3: basic coroutine and cosocket
158158
--- stream_server_config
159-
lua_resolver $TEST_NGINX_RESOLVER;
159+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
160160
content_by_lua_block {
161161
function worker(url)
162162
local sock = ngx.socket.tcp()
@@ -347,7 +347,7 @@ successfully connected to: openresty.org
347347
348348
=== TEST 7: coroutine wrap and cosocket
349349
--- stream_server_config
350-
lua_resolver $TEST_NGINX_RESOLVER;
350+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
351351
content_by_lua_block {
352352
function worker(url)
353353
local sock = ngx.socket.tcp()
@@ -861,7 +861,7 @@ test10
861861
--- stream_config
862862
init_by_lua_block { return }
863863
--- stream_server_config
864-
lua_resolver $TEST_NGINX_RESOLVER;
864+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
865865
content_by_lua_block {
866866
function worker(url)
867867
local sock = ngx.socket.tcp()
@@ -913,7 +913,7 @@ successfully connected to: agentzh.org
913913
init_by_lua_file html/init.lua;
914914
915915
--- stream_server_config
916-
lua_resolver $TEST_NGINX_RESOLVER;
916+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
917917
content_by_lua_block {
918918
function worker(url)
919919
local sock = ngx.socket.tcp()

t/124-init-worker.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ qr/warn\(\): time: \d+/
397397
=== TEST 13: cosocket with resolver
398398
--- timeout: 10
399399
--- stream_config
400-
lua_resolver $TEST_NGINX_RESOLVER;
400+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
401401
lua_resolver_timeout 3s;
402402
403403
init_worker_by_lua_block {

t/127-uthread-kill.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ resolve name done: -2
177177

178178
=== TEST 4: kill pending connect
179179
--- stream_server_config
180-
lua_resolver $TEST_NGINX_RESOLVER;
180+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
181181
content_by_lua_block {
182182
local ready = false
183183
function f()

t/128-duplex-tcp-socket.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ F(ngx_http_lua_socket_tcp_finalize_write_part) {
339339
=== TEST 5: concurrent socket operations while connecting
340340
--- stream_server_config
341341
lua_socket_log_errors off;
342-
lua_resolver $TEST_NGINX_RESOLVER;
342+
lua_resolver $TEST_NGINX_RESOLVER ipv6=off;
343343
content_by_lua_block {
344344
local sock = ngx.socket.tcp()
345345

0 commit comments

Comments
 (0)