From c9e854c7fb93ceab98f79719c3316f0968fb823b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 19:05:40 -1000 Subject: 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. --- tests/t0003-cache.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') 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. -- cgit 2.12.1