# HG changeset patch # User Sergey Kandaurov # Date 1416415533 -10800 # Node ID b4d657ba1a62c13a59b4796d0d4abadf72e06341 # Parent a3b03c333ad56ce50434708a2275c622d38c036b Tests: tests for range requests below proxy_cache_min_uses. diff --git a/proxy_cache_range.t b/proxy_cache_range.t --- a/proxy_cache_range.t +++ b/proxy_cache_range.t @@ -23,7 +23,7 @@ select STDOUT; $| = 1; plan(skip_all => 'win32') if $^O eq 'MSWin32'; -my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(5) +my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(7) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -48,6 +48,12 @@ http { proxy_cache NAME; proxy_cache_valid 200 1m; } + location /min_uses { + proxy_pass http://127.0.0.1:8081/; + proxy_cache NAME; + proxy_cache_valid 200 1m; + proxy_cache_min_uses 2; + } } server { @@ -81,6 +87,17 @@ like(http_get_range('/t.html?1', 'Range: like(http_get_range('/t.html?1', 'Range: bytes=0-2,4-'), qr/^SEE.*^THIS/ms, 'cached multipart range'); +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.7.8'); + +like(http_get_range('/min_uses/t.html?3', 'Range: bytes=4-'), + qr/^THIS/m, 'range below min_uses'); + +like(http_get_range('/min_uses/t.html?4', 'Range: bytes=0-2,4-'), + qr/^SEE.*^THIS/ms, 'multipart range below min_uses'); + +} + like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); ###############################################################################