Mercurial > hg > nginx-tests
comparison proxy_noclose.t @ 974:882267679006
Tests: simplified parallel modifications in tests.
Mail tests were simplified in c227348453db.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 12 Jul 2016 17:39:03 +0300 |
parents | e9064d691790 |
children |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
45 | 45 |
46 http { | 46 http { |
47 %%TEST_GLOBALS_HTTP%% | 47 %%TEST_GLOBALS_HTTP%% |
48 | 48 |
49 server { | 49 server { |
50 listen 127.0.0.1:%%PORT_0%%; | 50 listen 127.0.0.1:8080; |
51 server_name localhost; | 51 server_name localhost; |
52 | 52 |
53 location / { | 53 location / { |
54 proxy_pass http://127.0.0.1:%%PORT_1%%; | 54 proxy_pass http://127.0.0.1:8081; |
55 proxy_read_timeout 2s; | 55 proxy_read_timeout 2s; |
56 } | 56 } |
57 | 57 |
58 location /uselen { | 58 location /uselen { |
59 proxy_pass http://127.0.0.1:%%PORT_1%%; | 59 proxy_pass http://127.0.0.1:8081; |
60 | 60 |
61 # test will wait only 2s for reply, we it will fail if | 61 # test will wait only 2s for reply, we it will fail if |
62 # Content-Length not used as a hint | 62 # Content-Length not used as a hint |
63 | 63 |
64 proxy_read_timeout 10s; | 64 proxy_read_timeout 10s; |
67 } | 67 } |
68 | 68 |
69 EOF | 69 EOF |
70 | 70 |
71 $t->run_daemon(\&http_noclose_daemon); | 71 $t->run_daemon(\&http_noclose_daemon); |
72 $t->run()->waitforsocket('127.0.0.1:' . port(1)); | 72 $t->run()->waitforsocket('127.0.0.1:' . port(8081)); |
73 | 73 |
74 ############################################################################### | 74 ############################################################################### |
75 | 75 |
76 like(http_get('/'), qr/SEE-THIS/, 'request to bad backend'); | 76 like(http_get('/'), qr/SEE-THIS/, 'request to bad backend'); |
77 like(http_get('/multi'), qr/AND-THIS/, 'bad backend - multiple packets'); | 77 like(http_get('/multi'), qr/AND-THIS/, 'bad backend - multiple packets'); |
88 ############################################################################### | 88 ############################################################################### |
89 | 89 |
90 sub http_noclose_daemon { | 90 sub http_noclose_daemon { |
91 my $server = IO::Socket::INET->new( | 91 my $server = IO::Socket::INET->new( |
92 Proto => 'tcp', | 92 Proto => 'tcp', |
93 LocalAddr => '127.0.0.1:' . port(1), | 93 LocalAddr => '127.0.0.1:' . port(8081), |
94 Listen => 5, | 94 Listen => 5, |
95 Reuse => 1 | 95 Reuse => 1 |
96 ) | 96 ) |
97 or die "Can't create listening socket: $!\n"; | 97 or die "Can't create listening socket: $!\n"; |
98 | 98 |