# HG changeset patch # User Maxim Dounin # Date 1363104445 -14400 # Node ID 970bb423e59fa87fcc9c6ad3e320faf28f5fb4ae # Parent 8dac281ff5229822e33dec66c8a3c3d7996fa551 Tests: proxy_next_upstream tests in body.t, body_chunked.t. diff --git a/body.t b/body.t --- a/body.t +++ b/body.t @@ -22,7 +22,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(11); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(12); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -36,6 +36,11 @@ events { http { %%TEST_GLOBALS_HTTP%% + upstream u { + server 127.0.0.1:8082; + server 127.0.0.1:8080 backup; + } + server { listen 127.0.0.1:8080; server_name localhost; @@ -68,6 +73,9 @@ http { location /discard { return 200 "TEST\n"; } + location /next { + proxy_pass http://u/; + } } server { @@ -78,6 +86,15 @@ http { return 200 "TEST\n"; } } + + server { + listen 127.0.0.1:8082; + server_name localhost; + + location / { + return 444; + } + } } EOF @@ -122,6 +139,11 @@ like(http_get_body('/discard', '01234567 like(http_get_body('/small', '0123456789'), qr/X-Body: 0123456789\x0d?$/ms, 'small body in file only'); +# proxy_next_upstream + +like(http_get_body('/next', '0123456789'), + qr/X-Body: 0123456789\x0d?$/ms, 'body next upstream'); + ############################################################################### sub read_body_file { diff --git a/body_chunked.t b/body_chunked.t --- a/body_chunked.t +++ b/body_chunked.t @@ -22,7 +22,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(9); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(10); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -36,6 +36,11 @@ events { http { %%TEST_GLOBALS_HTTP%% + upstream u { + server 127.0.0.1:8082; + server 127.0.0.1:8080 backup; + } + server { listen 127.0.0.1:8080; server_name localhost; @@ -64,6 +69,9 @@ http { location /discard { return 200 "TEST\n"; } + location /next { + proxy_pass http://u/; + } } server { @@ -74,6 +82,15 @@ http { return 200 "TEST\n"; } } + + server { + listen 127.0.0.1:8082; + server_name localhost; + + location / { + return 444; + } + } } EOF @@ -114,6 +131,11 @@ like(http_get_body('/discard', '01234567 '0123456789', 'foobar'), qr/(TEST.*){4}/ms, 'chunked body discard 2'); +# proxy_next_upstream + +like(http_get_body('/next', '0123456789'), + qr/X-Body: 0123456789\x0d?$/ms, 'body chunked next upstream'); + } ###############################################################################