Mercurial > hg > nginx-tests
changeset 1008:bab7b53a156f
Tests: proxy cache range with sendfile in threads.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 22 Aug 2016 13:09:56 +0300 |
parents | 174e900c00dc |
children | 9f576b8bb4c8 |
files | proxy_cache_range.t |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy_cache_range.t Fri Aug 19 18:15:57 2016 +0300 +++ b/proxy_cache_range.t Mon Aug 22 13:09:56 2016 +0300 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(6) +my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(7) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -59,6 +59,9 @@ server_name localhost; location / { + if ($arg_s) { + limit_rate 50k; + } } } } @@ -66,6 +69,12 @@ EOF $t->write_file('t.html', 'SEE-THIS'); + +# should not fit in a single proxy buffer + +$t->write_file('tbig.html', + join('', map { sprintf "XX%06dXX", $_ } (1 .. 7000))); + $t->run(); ############################################################################### @@ -91,6 +100,15 @@ like(http_get_range('/min_uses/t.html?4', 'Range: bytes=0-2,4-'), qr/^SEE.*^THIS/ms, 'multipart range below min_uses'); +TODO: { +local $TODO = 'not yet' if $t->read_file('nginx.conf') =~ /sendfile on/ + and $t->read_file('nginx.conf') =~ /aio threads/ and $^O eq 'linux'; + +like(http_get_range('/tbig.html?s=1', 'Range: bytes=0-19'), + qr/^XX000001XXXX000002XX$/ms, 'range of response received in parts'); + +} + ############################################################################### sub http_get_range {