Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test a cache-max-slot-size of 0 and below
No test set either value, so a size check that took 0 as a limit of no
bytes, or a parser that ignored such a value, passed. Under the 64 MB
default an ignored value still keeps the big page, so each one follows a
limit the page is past.
| -rw-r--r-- | MANUAL.txt | 5 | |
| -rwxr-xr-x | tests/t0003-cache.sh | 19 |
2 files changed, 22 insertions, 2 deletions
@@ -82,8 +82,9 @@ cache-index-ttl:: cache-max-slot-size:: Number which specifies the largest response, in kilobytes, that a cache slot may keep. A larger response is still served but not kept, which - caps the cache directory at about cache-size times this. Set to "0" to - remove the limit. Default value: "65536" (64 MB). See also: "The cache". + caps the cache directory at about cache-size times this. Set to "0", or + any negative value, to remove the limit. Default value: "65536" (64 MB). + See also: "The cache". cache-root:: Path used to store the cgit cache entries. A scan-path keeps its cached diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index c1b5163..3bdbe3f 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -264,6 +264,25 @@ test_expect_success 'an expired slot is dropped when its refill is too large' ' test_dir_is_empty cache3 ' +# MANUAL says a cache-max-slot-size of 0 removes the limit, and cgit reads one +# below 0 the same way. Each value comes after a limit the big blob page is +# well past, so the page keeps its slot only if the value read last lifts it. +test_expect_success 'a cache-max-slot-size of 0 or below lifts the limit' ' + for size in 0 -1 + do + rm -rf cache3 && mkdir cache3 && + { + echo "cache-max-slot-size=32" && + echo "cache-max-slot-size=$size" && + cat bigkeyrc + } >unlimitedrc && + cgit_ok unlimitedrc "url=bigpage/tree/big.txt" >/dev/null && + ls cache3 >unlimited.slots && + test_line_count = 1 unlimited.slots || + { echo "cache-max-slot-size=$size kept no slot" && return 1; } + done +' + # A slot past its ttl is rendered again, and the new page is both what the # request gets and what the slot keeps. The ttl is long enough that the copy # is still served after the commit, which shows the slot is in use. |
