Mercurial > hg > nginx-tests
comparison proxy.t @ 802:eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Dec 2015 19:00:41 +0300 |
parents | 122cd3a82367 |
children | 93d900bac201 |
comparison
equal
deleted
inserted
replaced
801:d95c4b8e5517 | 802:eca9b1d19021 |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5); | 24 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(6); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
32 events { | 32 events { |
33 } | 33 } |
34 | 34 |
35 http { | 35 http { |
36 %%TEST_GLOBALS_HTTP%% | 36 %%TEST_GLOBALS_HTTP%% |
37 | |
38 upstream u { | |
39 server 127.0.0.1:8081; | |
40 } | |
37 | 41 |
38 server { | 42 server { |
39 listen 127.0.0.1:8080; | 43 listen 127.0.0.1:8080; |
40 server_name localhost; | 44 server_name localhost; |
41 | 45 |
63 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets'); | 67 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets'); |
64 | 68 |
65 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request'); | 69 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request'); |
66 | 70 |
67 like(http_get('/var?b=127.0.0.1:8081/'), qr/SEE-THIS/, 'proxy with variables'); | 71 like(http_get('/var?b=127.0.0.1:8081/'), qr/SEE-THIS/, 'proxy with variables'); |
72 like(http_get('/var?b=u/'), qr/SEE-THIS/, 'proxy with variables to upstream'); | |
68 | 73 |
69 my $s = http('', start => 1); | 74 my $s = http('', start => 1); |
70 | 75 |
71 sleep 3; | 76 sleep 3; |
72 | 77 |