comparison http_resolver.t @ 449:0bc79a098213

Tests: added resolver timeout test with multiple requests sent. Ensure that DNS resolution timeout is counted by all requests that resolve a particular name.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 19 Aug 2014 16:48:58 +0400
parents 60888e2c3f5a
children 9e26d5b10fb3
comparison
equal deleted inserted replaced
448:29ee0d2b0746 449:0bc79a098213
68 location /resend { 68 location /resend {
69 resolver 127.0.0.1:8081; 69 resolver 127.0.0.1:8081;
70 resolver_timeout 6s; 70 resolver_timeout 6s;
71 proxy_pass http://$host:8080/backend; 71 proxy_pass http://$host:8080/backend;
72 } 72 }
73 location /bad {
74 resolver 127.0.0.1:8089;
75 resolver_timeout 1s;
76 proxy_pass http://$host:8080/backend;
77 }
73 78
74 location /backend { 79 location /backend {
75 return 200; 80 return 200;
76 } 81 }
77 location /50x { 82 location /50x {
83 EOF 88 EOF
84 89
85 $t->run_daemon(\&dns_daemon, 8081, $t); 90 $t->run_daemon(\&dns_daemon, 8081, $t);
86 $t->run_daemon(\&dns_daemon, 8082, $t); 91 $t->run_daemon(\&dns_daemon, 8082, $t);
87 92
88 $t->run()->plan(31); 93 $t->run()->plan(32);
89 94
90 $t->waitforfile($t->testdir . '/8081'); 95 $t->waitforfile($t->testdir . '/8081');
91 $t->waitforfile($t->testdir . '/8082'); 96 $t->waitforfile($t->testdir . '/8082');
92 97
93 ############################################################################### 98 ###############################################################################
223 228
224 TODO: { 229 TODO: {
225 local $TODO = 'not yet' unless $t->has_version('1.7.4'); 230 local $TODO = 'not yet' unless $t->has_version('1.7.4');
226 231
227 like(http_end($s), qr/200 OK/, 'resend after malformed response'); 232 like(http_end($s), qr/200 OK/, 'resend after malformed response');
233
234 }
235
236 $s = http_get('/bad', start => 1);
237 my $s2 = http_get('/bad', start => 1);
238
239 TODO: {
240 local $TODO = 'hangs';
241
242 http_end($s);
243 ok(http_end($s2), 'timeout handler on 2nd request');
228 244
229 } 245 }
230 246
231 ############################################################################### 247 ###############################################################################
232 248