Mercurial > hg > nginx-tests
comparison fastcgi_keepalive.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 | d5bf5942a8b2 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
33 | 33 |
34 http { | 34 http { |
35 %%TEST_GLOBALS_HTTP%% | 35 %%TEST_GLOBALS_HTTP%% |
36 | 36 |
37 upstream backend { | 37 upstream backend { |
38 server 127.0.0.1:8081; | 38 server 127.0.0.1:%%PORT_1%%; |
39 keepalive 1; | 39 keepalive 1; |
40 } | 40 } |
41 | 41 |
42 server { | 42 server { |
43 listen 127.0.0.1:8080; | 43 listen 127.0.0.1:%%PORT_0%%; |
44 server_name localhost; | 44 server_name localhost; |
45 | 45 |
46 location / { | 46 location / { |
47 fastcgi_pass backend; | 47 fastcgi_pass backend; |
48 fastcgi_keep_conn on; | 48 fastcgi_keep_conn on; |
51 } | 51 } |
52 | 52 |
53 EOF | 53 EOF |
54 | 54 |
55 $t->run_daemon(\&fastcgi_test_daemon); | 55 $t->run_daemon(\&fastcgi_test_daemon); |
56 $t->run()->waitforsocket('127.0.0.1:8081'); | 56 $t->run()->waitforsocket('127.0.0.1:' . port(1)); |
57 | 57 |
58 ############################################################################### | 58 ############################################################################### |
59 | 59 |
60 like(http_get('/'), qr/SEE-THIS/, 'fastcgi request'); | 60 like(http_get('/'), qr/SEE-THIS/, 'fastcgi request'); |
61 like(http_get('/redir'), qr/ 302 /, 'fastcgi redirect'); | 61 like(http_get('/redir'), qr/ 302 /, 'fastcgi redirect'); |
136 } | 136 } |
137 | 137 |
138 sub fastcgi_test_daemon { | 138 sub fastcgi_test_daemon { |
139 my $server = IO::Socket::INET->new( | 139 my $server = IO::Socket::INET->new( |
140 Proto => 'tcp', | 140 Proto => 'tcp', |
141 LocalAddr => '127.0.0.1:8081', | 141 LocalAddr => '127.0.0.1:' . port(1), |
142 Listen => 5, | 142 Listen => 5, |
143 Reuse => 1 | 143 Reuse => 1 |
144 ) | 144 ) |
145 or die "Can't create listening socket: $!\n"; | 145 or die "Can't create listening socket: $!\n"; |
146 | 146 |
165 | 165 |
166 $rcount++; | 166 $rcount++; |
167 | 167 |
168 # respond | 168 # respond |
169 fastcgi_respond($h, <<EOF); | 169 fastcgi_respond($h, <<EOF); |
170 Location: http://localhost:8080/redirect | 170 Location: http://localhost/redirect |
171 Content-Type: text/html | 171 Content-Type: text/html |
172 | 172 |
173 SEE-THIS | 173 SEE-THIS |
174 request: $rcount | 174 request: $rcount |
175 connection: $ccount | 175 connection: $ccount |