changeset 500:b4d657ba1a62

Tests: tests for range requests below proxy_cache_min_uses.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 19 Nov 2014 19:45:33 +0300
parents a3b03c333ad5
children 0ee2899fbe3e
files proxy_cache_range.t
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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');
 
 ###############################################################################