Mercurial > hg > nginx-tests
comparison scgi_cache.t @ 960:d4a0232425ee
Tests: fixed race in SCGI tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 24 Jun 2016 16:30:08 +0300 |
parents | e9064d691790 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
959:508ee7ea9706 | 960:d4a0232425ee |
---|---|
57 } | 57 } |
58 | 58 |
59 EOF | 59 EOF |
60 | 60 |
61 $t->run_daemon(\&scgi_daemon); | 61 $t->run_daemon(\&scgi_daemon); |
62 $t->run(); | 62 $t->run()->waitforsocket('127.0.0.1:' . port(1)); |
63 | 63 |
64 ############################################################################### | 64 ############################################################################### |
65 | 65 |
66 like(http_get('/len'), qr/MISS/, 'length'); | 66 like(http_get('/len'), qr/MISS/, 'length'); |
67 like(http_get('/len'), qr/HIT/, 'length cached'); | 67 like(http_get('/len'), qr/HIT/, 'length cached'); |
91 | 91 |
92 my $scgi = SCGI->new($server, blocking => 1); | 92 my $scgi = SCGI->new($server, blocking => 1); |
93 my %count; | 93 my %count; |
94 | 94 |
95 while (my $request = $scgi->accept()) { | 95 while (my $request = $scgi->accept()) { |
96 $request->read_env(); | 96 eval { $request->read_env(); }; |
97 next if $@; | |
97 | 98 |
98 my $uri = $request->env->{REQUEST_URI} || ''; | 99 my $uri = $request->env->{REQUEST_URI} || ''; |
99 my $c = $request->connection(); | 100 my $c = $request->connection(); |
100 | 101 |
101 $count{$uri} ||= 0; | 102 $count{$uri} ||= 0; |