Mercurial > hg > nginx-tests
comparison proxy_unfinished.t @ 952:e9064d691790
Tests: converted tests to run in parallel.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 21 Jun 2016 16:39:13 +0300 |
parents | cfddaf316233 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
47 | 47 |
48 proxy_cache_path %%TESTDIR%%/cache levels=1:2 | 48 proxy_cache_path %%TESTDIR%%/cache levels=1:2 |
49 keys_zone=one:1m; | 49 keys_zone=one:1m; |
50 | 50 |
51 server { | 51 server { |
52 listen 127.0.0.1:8080 sndbuf=32k; | 52 listen 127.0.0.1:%%PORT_0%% sndbuf=32k; |
53 server_name localhost; | 53 server_name localhost; |
54 | 54 |
55 location / { | 55 location / { |
56 sub_filter foo bar; | 56 sub_filter foo bar; |
57 sub_filter_types *; | 57 sub_filter_types *; |
58 proxy_pass http://127.0.0.1:8081; | 58 proxy_pass http://127.0.0.1:%%PORT_1%%; |
59 } | 59 } |
60 | 60 |
61 location /un/ { | 61 location /un/ { |
62 sub_filter foo bar; | 62 sub_filter foo bar; |
63 sub_filter_types *; | 63 sub_filter_types *; |
64 proxy_pass http://127.0.0.1:8081/; | 64 proxy_pass http://127.0.0.1:%%PORT_1%%/; |
65 proxy_buffering off; | 65 proxy_buffering off; |
66 } | 66 } |
67 | 67 |
68 location /cache/ { | 68 location /cache/ { |
69 proxy_pass http://127.0.0.1:8081/; | 69 proxy_pass http://127.0.0.1:%%PORT_1%%/; |
70 proxy_cache one; | 70 proxy_cache one; |
71 add_header X-Cache-Status $upstream_cache_status; | 71 add_header X-Cache-Status $upstream_cache_status; |
72 } | 72 } |
73 | 73 |
74 location /proxy/ { | 74 location /proxy/ { |
75 sub_filter foo bar; | 75 sub_filter foo bar; |
76 sub_filter_types *; | 76 sub_filter_types *; |
77 proxy_pass http://127.0.0.1:8080/local/; | 77 proxy_pass http://127.0.0.1:%%PORT_0%%/local/; |
78 proxy_buffer_size 1k; | 78 proxy_buffer_size 1k; |
79 proxy_buffers 4 1k; | 79 proxy_buffers 4 1k; |
80 } | 80 } |
81 | 81 |
82 location /local/ { | 82 location /local/ { |
88 EOF | 88 EOF |
89 | 89 |
90 $t->write_file('big.html', 'X' x (1024 * 1024) . 'finished'); | 90 $t->write_file('big.html', 'X' x (1024 * 1024) . 'finished'); |
91 | 91 |
92 $t->run_daemon(\&http_daemon); | 92 $t->run_daemon(\&http_daemon); |
93 $t->run()->waitforsocket('127.0.0.1:8081'); | 93 $t->run()->waitforsocket('127.0.0.1:' . port(1)); |
94 | 94 |
95 ############################################################################### | 95 ############################################################################### |
96 | 96 |
97 http_get('/cache/length'); | 97 http_get('/cache/length'); |
98 like(http_get('/cache/length'), qr/MISS/, 'unfinished not cached'); | 98 like(http_get('/cache/length'), qr/MISS/, 'unfinished not cached'); |
161 ############################################################################### | 161 ############################################################################### |
162 | 162 |
163 sub http_daemon { | 163 sub http_daemon { |
164 my $server = IO::Socket::INET->new( | 164 my $server = IO::Socket::INET->new( |
165 Proto => 'tcp', | 165 Proto => 'tcp', |
166 LocalAddr => '127.0.0.1:8081', | 166 LocalAddr => '127.0.0.1:' . port(1), |
167 Listen => 5, | 167 Listen => 5, |
168 Reuse => 1 | 168 Reuse => 1 |
169 ) | 169 ) |
170 or die "Can't create listening socket: $!\n"; | 170 or die "Can't create listening socket: $!\n"; |
171 | 171 |