comparison proxy_noclose.t @ 952:e9064d691790

Tests: converted tests to run in parallel.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 21 Jun 2016 16:39:13 +0300
parents 71dfce15bbba
children 882267679006
comparison
equal deleted inserted replaced
951:9361c7eddfc1 952:e9064d691790
45 45
46 http { 46 http {
47 %%TEST_GLOBALS_HTTP%% 47 %%TEST_GLOBALS_HTTP%%
48 48
49 server { 49 server {
50 listen 127.0.0.1:8080; 50 listen 127.0.0.1:%%PORT_0%%;
51 server_name localhost; 51 server_name localhost;
52 52
53 location / { 53 location / {
54 proxy_pass http://127.0.0.1:8081; 54 proxy_pass http://127.0.0.1:%%PORT_1%%;
55 proxy_read_timeout 2s; 55 proxy_read_timeout 2s;
56 } 56 }
57 57
58 location /uselen { 58 location /uselen {
59 proxy_pass http://127.0.0.1:8081; 59 proxy_pass http://127.0.0.1:%%PORT_1%%;
60 60
61 # test will wait only 2s for reply, we it will fail if 61 # test will wait only 2s for reply, we it will fail if
62 # Content-Length not used as a hint 62 # Content-Length not used as a hint
63 63
64 proxy_read_timeout 10s; 64 proxy_read_timeout 10s;
67 } 67 }
68 68
69 EOF 69 EOF
70 70
71 $t->run_daemon(\&http_noclose_daemon); 71 $t->run_daemon(\&http_noclose_daemon);
72 $t->run()->waitforsocket('127.0.0.1:8081'); 72 $t->run()->waitforsocket('127.0.0.1:' . port(1));
73 73
74 ############################################################################### 74 ###############################################################################
75 75
76 like(http_get('/'), qr/SEE-THIS/, 'request to bad backend'); 76 like(http_get('/'), qr/SEE-THIS/, 'request to bad backend');
77 like(http_get('/multi'), qr/AND-THIS/, 'bad backend - multiple packets'); 77 like(http_get('/multi'), qr/AND-THIS/, 'bad backend - multiple packets');
88 ############################################################################### 88 ###############################################################################
89 89
90 sub http_noclose_daemon { 90 sub http_noclose_daemon {
91 my $server = IO::Socket::INET->new( 91 my $server = IO::Socket::INET->new(
92 Proto => 'tcp', 92 Proto => 'tcp',
93 LocalAddr => '127.0.0.1:8081', 93 LocalAddr => '127.0.0.1:' . port(1),
94 Listen => 5, 94 Listen => 5,
95 Reuse => 1 95 Reuse => 1
96 ) 96 )
97 or die "Can't create listening socket: $!\n"; 97 or die "Can't create listening socket: $!\n";
98 98