Mercurial > hg > nginx-tests
diff proxy_variables.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 | dbe5bc4b8b39 |
children | 882267679006 |
line wrap: on
line diff
--- a/proxy_variables.t +++ b/proxy_variables.t @@ -36,15 +36,15 @@ http { %%TEST_GLOBALS_HTTP%% upstream u { - server 127.0.0.1:8081; - server 127.0.0.1:8081; + server 127.0.0.1:%%PORT_1%%; + server 127.0.0.1:%%PORT_1%%; } log_format time '$upstream_connect_time:$upstream_header_time:' '$upstream_response_time'; server { - listen 127.0.0.1:8080; + listen 127.0.0.1:%%PORT_0%%; server_name localhost; add_header X-Connect $upstream_connect_time; @@ -52,7 +52,7 @@ http { add_header X-Response $upstream_response_time; location / { - proxy_pass http://127.0.0.1:8081; + proxy_pass http://127.0.0.1:%%PORT_1%%; access_log %%TESTDIR%%/time.log time; } @@ -61,7 +61,7 @@ http { } location /vars { - proxy_pass http://127.0.0.1:8080/stub; + proxy_pass http://127.0.0.1:%%PORT_0%%/stub; add_header X-Proxy-Host $proxy_host; add_header X-Proxy-Port $proxy_port; @@ -75,18 +75,19 @@ http { EOF $t->write_file('stub', ''); -$t->run_daemon(\&http_daemon, 8081); +$t->run_daemon(\&http_daemon, port(1)); $t->try_run('no upstream_connect_time')->plan(18); -$t->waitforsocket('127.0.0.1:8081'); +$t->waitforsocket('127.0.0.1:' . port(1)); ############################################################################### my $re = qr/(\d\.\d{3})/; +my $p0 = port(0); my ($ct, $ht, $rt, $ct2, $ht2, $rt2); -like(http_get('/vars'), qr/X-Proxy-Host:\s127\.0\.0\.1:8080/, 'proxy_host'); -like(http_get('/vars'), qr/X-Proxy-Port:\s8080/, 'proxy_port'); +like(http_get('/vars'), qr/X-Proxy-Host:\s127\.0\.0\.1:$p0/, 'proxy_host'); +like(http_get('/vars'), qr/X-Proxy-Port:\s$p0/, 'proxy_port'); like(http_xff('/vars', '192.0.2.1'), qr/X-Proxy-Forwarded:.*192\.0\.2\.1/, 'proxy_add_x_forwarded_for');