comparison fastcgi_cache.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 fa71c725d40a
children 882267679006
comparison
equal deleted inserted replaced
951:9361c7eddfc1 952:e9064d691790
40 40
41 fastcgi_cache_path %%TESTDIR%%/cache levels=1:2 41 fastcgi_cache_path %%TESTDIR%%/cache levels=1:2
42 keys_zone=NAME:1m; 42 keys_zone=NAME:1m;
43 43
44 server { 44 server {
45 listen 127.0.0.1:8080; 45 listen 127.0.0.1:%%PORT_0%%;
46 server_name localhost; 46 server_name localhost;
47 47
48 location / { 48 location / {
49 fastcgi_pass 127.0.0.1:8081; 49 fastcgi_pass 127.0.0.1:%%PORT_1%%;
50 fastcgi_param REQUEST_URI $request_uri; 50 fastcgi_param REQUEST_URI $request_uri;
51 fastcgi_cache NAME; 51 fastcgi_cache NAME;
52 fastcgi_cache_key $request_uri; 52 fastcgi_cache_key $request_uri;
53 fastcgi_cache_valid 302 1m; 53 fastcgi_cache_valid 302 1m;
54 } 54 }
56 } 56 }
57 57
58 EOF 58 EOF
59 59
60 $t->run_daemon(\&fastcgi_daemon); 60 $t->run_daemon(\&fastcgi_daemon);
61 $t->run()->waitforsocket('127.0.0.1:8081'); 61 $t->run()->waitforsocket('127.0.0.1:' . port(1));
62 62
63 ############################################################################### 63 ###############################################################################
64 64
65 like(http_get('/'), qr/SEE-THIS.*^1$/ms, 'fastcgi request'); 65 like(http_get('/'), qr/SEE-THIS.*^1$/ms, 'fastcgi request');
66 like(http_get('/'), qr/SEE-THIS.*^1$/ms, 'fastcgi request cached'); 66 like(http_get('/'), qr/SEE-THIS.*^1$/ms, 'fastcgi request cached');
77 } 77 }
78 78
79 ############################################################################### 79 ###############################################################################
80 80
81 sub fastcgi_daemon { 81 sub fastcgi_daemon {
82 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); 82 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(1), 5);
83 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, 83 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,
84 $socket); 84 $socket);
85 85
86 my $count; 86 my $count;
87 while( $request->Accept() >= 0 ) { 87 while( $request->Accept() >= 0 ) {
90 if ($ENV{REQUEST_URI} eq '/stderr') { 90 if ($ENV{REQUEST_URI} eq '/stderr') {
91 warn "sample stderr text" x 512; 91 warn "sample stderr text" x 512;
92 } 92 }
93 93
94 print <<EOF; 94 print <<EOF;
95 Location: http://127.0.0.1:8080/redirect 95 Location: http://localhost/redirect
96 Content-Type: text/html 96 Content-Type: text/html
97 97
98 SEE-THIS 98 SEE-THIS
99 $count 99 $count
100 EOF 100 EOF