comparison fastcgi_body2.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 6bb1f2ccd386
children 882267679006
comparison
equal deleted inserted replaced
951:9361c7eddfc1 952:e9064d691790
40 40
41 http { 41 http {
42 %%TEST_GLOBALS_HTTP%% 42 %%TEST_GLOBALS_HTTP%%
43 43
44 upstream u { 44 upstream u {
45 server 127.0.0.1:8081 max_fails=0; 45 server 127.0.0.1:%%PORT_1%% max_fails=0;
46 server 127.0.0.1:8082; 46 server 127.0.0.1:%%PORT_2%%;
47 } 47 }
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 fastcgi_pass u; 54 fastcgi_pass u;
55 fastcgi_param REQUEST_URI $request_uri; 55 fastcgi_param REQUEST_URI $request_uri;
69 } 69 }
70 } 70 }
71 71
72 EOF 72 EOF
73 73
74 $t->run_daemon(\&fastcgi_daemon, 8081); 74 $t->run_daemon(\&fastcgi_daemon, port(1));
75 $t->run_daemon(\&fastcgi_daemon, 8082); 75 $t->run_daemon(\&fastcgi_daemon, port(2));
76 $t->run(); 76 $t->run();
77 77
78 $t->waitforsocket('127.0.0.1:8081'); 78 $t->waitforsocket('127.0.0.1:' . port(1));
79 $t->waitforsocket('127.0.0.1:8082'); 79 $t->waitforsocket('127.0.0.1:' . port(2));
80 80
81 ############################################################################### 81 ###############################################################################
82 82
83 like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/, 83 like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/,
84 'body length - in file'); 84 'body length - in file');
114 114
115 while( $request->Accept() >= 0 ) { 115 while( $request->Accept() >= 0 ) {
116 read(STDIN, my $body, $ENV{'CONTENT_LENGTH'}); 116 read(STDIN, my $body, $ENV{'CONTENT_LENGTH'});
117 my $len = length $body; 117 my $len = length $body;
118 118
119 sleep 3 if $port == 8081; 119 sleep 3 if $port == port(1);
120 120
121 print <<EOF; 121 print <<EOF;
122 Location: http://127.0.0.1:8080/redirect 122 Location: http://localhost/redirect
123 Content-Type: text/html 123 Content-Type: text/html
124 X-Length: $len 124 X-Length: $len
125 125
126 EOF 126 EOF
127 } 127 }