Mercurial > hg > nginx-tests
changeset 801:d95c4b8e5517
Tests: more tests for passing requests to host given by expression.
This complements tests for scgi_pass, fastcgi_pass, uwsgi_pass with variables
that evaluate to an implicit upstream.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Dec 2015 18:59:26 +0300 |
parents | 51d3243a762f |
children | eca9b1d19021 |
files | fastcgi.t scgi.t uwsgi.t |
diffstat | 3 files changed, 26 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/fastcgi.t Wed Dec 09 17:49:30 2015 +0300 +++ b/fastcgi.t Wed Dec 09 18:59:26 2015 +0300 @@ -25,7 +25,7 @@ plan(skip_all => 'FCGI not installed') if $@; plan(skip_all => 'win32') if $^O eq 'MSWin32'; -my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(5) +my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(6) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -46,6 +46,11 @@ fastcgi_pass 127.0.0.1:8081; fastcgi_param REQUEST_URI $request_uri; } + + location /var { + fastcgi_pass $arg_b; + fastcgi_param REQUEST_URI $request_uri; + } } } @@ -64,6 +69,8 @@ like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled'); +like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'fastcgi with variables'); + ############################################################################### sub fastcgi_daemon {
--- a/scgi.t Wed Dec 09 17:49:30 2015 +0300 +++ b/scgi.t Wed Dec 09 18:59:26 2015 +0300 @@ -24,7 +24,7 @@ eval { require SCGI; }; plan(skip_all => 'SCGI not installed') if $@; -my $t = Test::Nginx->new()->has(qw/http scgi/)->plan(5) +my $t = Test::Nginx->new()->has(qw/http scgi/)->plan(6) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -47,6 +47,13 @@ scgi_param REQUEST_URI $request_uri; scgi_param HTTP_X_BLAH "blah"; } + + location /var { + scgi_pass $arg_b; + scgi_param SCGI 1; + scgi_param REQUEST_URI $request_uri; + } + } } @@ -66,6 +73,8 @@ like(http_get_headers('/headers'), qr/SEE-THIS/, 'scgi request with many ignored headers'); +like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'scgi with variables'); + ############################################################################### sub http_get_headers {
--- a/uwsgi.t Wed Dec 09 17:49:30 2015 +0300 +++ b/uwsgi.t Wed Dec 09 18:59:26 2015 +0300 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http uwsgi/)->has_daemon('uwsgi')->plan(3) +my $t = Test::Nginx->new()->has(qw/http uwsgi/)->has_daemon('uwsgi')->plan(4) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -43,6 +43,11 @@ uwsgi_param SERVER_PROTOCOL $server_protocol; uwsgi_param HTTP_X_BLAH "blah"; } + + location /var { + uwsgi_pass $arg_b; + uwsgi_param SERVER_PROTOCOL $server_protocol; + } } } @@ -81,6 +86,8 @@ like(http_get_headers('/headers'), qr/SEE-THIS/, 'uwsgi request with many ignored headers'); +like(http_get('/var?b=127.0.0.1:8081'), qr/SEE-THIS/, 'uwsgi with variables'); + ############################################################################### sub http_get_headers {