comparison fastcgi_split.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 847ea345becb
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; 45 server 127.0.0.1:%%PORT_1%%;
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;
58 } 58 }
59 } 59 }
60 60
61 EOF 61 EOF
62 62
63 $t->run_daemon(\&fastcgi_daemon, 8081); 63 $t->run_daemon(\&fastcgi_daemon, port(1));
64 $t->run_daemon(\&fastcgi_daemon, 8082); 64 $t->run_daemon(\&fastcgi_daemon, port(2));
65 65
66 $t->run(); 66 $t->run();
67 67
68 $t->waitforsocket('127.0.0.1:8081'); 68 $t->waitforsocket('127.0.0.1:' . port(1));
69 $t->waitforsocket('127.0.0.1:8082'); 69 $t->waitforsocket('127.0.0.1:' . port(2));
70 70
71 ############################################################################### 71 ###############################################################################
72 72
73 like(http_get('/'), qr/^Good: header/ms, 'fastcgi next upstream'); 73 like(http_get('/'), qr/^Good: header/ms, 'fastcgi next upstream');
74 74
82 82
83 my $count; 83 my $count;
84 while( $request->Accept() >= 0 ) { 84 while( $request->Accept() >= 0 ) {
85 $count++; 85 $count++;
86 86
87 if ($port == 8081) { 87 if ($port == port(1)) {
88 print 'BAD'; 88 print 'BAD';
89 } 89 }
90 if ($port == 8082) { 90 if ($port == port(2)) {
91 print 'Good: header' . CRLF . CRLF; 91 print 'Good: header' . CRLF . CRLF;
92 } 92 }
93 } 93 }
94 94
95 FCGI::CloseSocket($socket); 95 FCGI::CloseSocket($socket);