comparison auth_request.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
42 42
43 proxy_cache_path %%TESTDIR%%/cache levels=1:2 43 proxy_cache_path %%TESTDIR%%/cache levels=1:2
44 keys_zone=NAME:1m; 44 keys_zone=NAME:1m;
45 45
46 server { 46 server {
47 listen 127.0.0.1:8080; 47 listen 127.0.0.1:%%PORT_0%%;
48 server_name localhost; 48 server_name localhost;
49 49
50 location / { 50 location / {
51 return 444; 51 return 444;
52 } 52 }
92 92
93 location /proxy { 93 location /proxy {
94 auth_request /auth-proxy; 94 auth_request /auth-proxy;
95 } 95 }
96 location = /auth-proxy { 96 location = /auth-proxy {
97 proxy_pass http://127.0.0.1:8080/auth-basic; 97 proxy_pass http://127.0.0.1:%%PORT_0%%/auth-basic;
98 proxy_pass_request_body off; 98 proxy_pass_request_body off;
99 proxy_set_header Content-Length ""; 99 proxy_set_header Content-Length "";
100 } 100 }
101 location = /auth-basic { 101 location = /auth-basic {
102 auth_basic "restricted"; 102 auth_basic "restricted";
103 auth_basic_user_file %%TESTDIR%%/htpasswd; 103 auth_basic_user_file %%TESTDIR%%/htpasswd;
104 } 104 }
105 105
106 location = /proxy-double { 106 location = /proxy-double {
107 proxy_pass http://127.0.0.1:8080/auth-error; 107 proxy_pass http://127.0.0.1:%%PORT_0%%/auth-error;
108 proxy_intercept_errors on; 108 proxy_intercept_errors on;
109 error_page 404 = /proxy-double-fallback; 109 error_page 404 = /proxy-double-fallback;
110 client_body_buffer_size 4k; 110 client_body_buffer_size 4k;
111 } 111 }
112 location = /proxy-double-fallback { 112 location = /proxy-double-fallback {
113 auth_request /auth-proxy-double; 113 auth_request /auth-proxy-double;
114 proxy_pass http://127.0.0.1:8080/auth-open; 114 proxy_pass http://127.0.0.1:%%PORT_0%%/auth-open;
115 } 115 }
116 location = /auth-proxy-double { 116 location = /auth-proxy-double {
117 proxy_pass http://127.0.0.1:8080/auth-open; 117 proxy_pass http://127.0.0.1:%%PORT_0%%/auth-open;
118 proxy_pass_request_body off; 118 proxy_pass_request_body off;
119 proxy_set_header Content-Length ""; 119 proxy_set_header Content-Length "";
120 } 120 }
121 121
122 location /proxy-cache { 122 location /proxy-cache {
123 auth_request /auth-proxy-cache; 123 auth_request /auth-proxy-cache;
124 } 124 }
125 location = /auth-proxy-cache { 125 location = /auth-proxy-cache {
126 proxy_pass http://127.0.0.1:8080/auth-basic; 126 proxy_pass http://127.0.0.1:%%PORT_0%%/auth-basic;
127 proxy_pass_request_body off; 127 proxy_pass_request_body off;
128 proxy_set_header Content-Length ""; 128 proxy_set_header Content-Length "";
129 proxy_cache NAME; 129 proxy_cache NAME;
130 proxy_cache_valid 1m; 130 proxy_cache_valid 1m;
131 } 131 }
132 132
133 location /fastcgi { 133 location /fastcgi {
134 auth_request /auth-fastcgi; 134 auth_request /auth-fastcgi;
135 } 135 }
136 location = /auth-fastcgi { 136 location = /auth-fastcgi {
137 fastcgi_pass 127.0.0.1:8081; 137 fastcgi_pass 127.0.0.1:%%PORT_1%%;
138 fastcgi_pass_request_body off; 138 fastcgi_pass_request_body off;
139 } 139 }
140 } 140 }
141 } 141 }
142 142
192 eval { require FCGI; }; 192 eval { require FCGI; };
193 skip 'FCGI not installed', 2 if $@; 193 skip 'FCGI not installed', 2 if $@;
194 skip 'win32', 2 if $^O eq 'MSWin32'; 194 skip 'win32', 2 if $^O eq 'MSWin32';
195 195
196 $t->run_daemon(\&fastcgi_daemon); 196 $t->run_daemon(\&fastcgi_daemon);
197 $t->waitforsocket('127.0.0.1:8081'); 197 $t->waitforsocket('127.0.0.1:' . port(1));
198 198
199 like(http_get('/fastcgi'), qr/ 404 /, 'fastcgi auth open'); 199 like(http_get('/fastcgi'), qr/ 404 /, 'fastcgi auth open');
200 unlike(http_get('/fastcgi'), qr/INVISIBLE/, 'fastcgi auth no content'); 200 unlike(http_get('/fastcgi'), qr/INVISIBLE/, 'fastcgi auth no content');
201 } 201 }
202 202
237 } 237 }
238 238
239 ############################################################################### 239 ###############################################################################
240 240
241 sub fastcgi_daemon { 241 sub fastcgi_daemon {
242 my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5); 242 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(1), 5);
243 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, 243 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,
244 $socket); 244 $socket);
245 245
246 while ($request->Accept() >= 0) { 246 while ($request->Accept() >= 0) {
247 print <<EOF; 247 print <<EOF;