Mercurial > hg > nginx-tests
changeset 606:530a3152753b
Tests: simple http proxy test with multiple http blocks.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 15 Jun 2015 19:59:59 +0300 |
parents | a77f19282f63 |
children | 97e88eff1433 |
files | http_block.t |
diffstat | 1 files changed, 70 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/http_block.t @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +# (C) Sergey Kandaurov +# (C) Nginx, Inc. + +# Tests for http proxy module with multiple http configuration blocks. + +############################################################################### + +use warnings; +use strict; + +use Test::More; + +BEGIN { use FindBin; chdir($FindBin::Bin); } + +use lib 'lib'; +use Test::Nginx; + +############################################################################### + +select STDERR; $| = 1; +select STDOUT; $| = 1; + +my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(1); + +$t->write_file_expand('nginx.conf', <<'EOF'); + +%%TEST_GLOBALS%% + +daemon off; + +events { +} + +http { + %%TEST_GLOBALS_HTTP%% + + server { + listen 127.0.0.1:8080; + server_name localhost; + + location / { + proxy_pass http://127.0.0.1:8081; + proxy_read_timeout 1s; + } + } +} + +http { + %%TEST_GLOBALS_HTTP%% + + server { + listen 127.0.0.1:8081; + server_name localhost; + + location / {} + } +} + +EOF + +$t->write_file('t', 'SEE-THIS'); +$t->run(); + +############################################################################### + +like(http_get('/t'), qr/SEE-THIS/, 'proxy request'); + +###############################################################################