From d9e213a81670fa69369f11645429f836ef6e99eb Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 16:45:15 -1000 Subject: Prove the cache keeps what the ttl test refuses cache_process bypasses a ttl of 0 and fails quietly in many ways, so with a dead cache the test passed whatever ttl the page got. A second config that keeps the same page for ever now has to replay it, from a cache of its own, since slots are keyed on the request alone. --- tests/t0303-robustness.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index f290609..1911cf8 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -540,20 +540,23 @@ test_expect_success 'an indented comment in the mimetype file is skipped' ' grep "^Content-Type: image/x-cgit" tmp ' +# A cache that stored nothing would pass the first config whatever its ttl, +# so a second keeps the same page for ever and has to show it unchanged. test_expect_success 'a refs page named with an id is not cached for ever' ' - { - echo "cache-size=10" && - echo "cache-root=$PWD/cache" && - echo "cache-static-ttl=-1" && - echo "cache-dynamic-ttl=0" && - echo "cache-summary-ttl=0" && - grep -v "^cache-size" robrc - } >ttlrc && + cgitrc_repo ttlrc rob cache-size=10 "cache-root=$PWD/ttlcache" \ + cache-static-ttl=-1 cache-dynamic-ttl=0 cache-summary-ttl=0 && + cgitrc_repo foreverrc rob cache-size=10 "cache-root=$PWD/forevercache" \ + cache-static-ttl=-1 cache-dynamic-ttl=-1 cache-summary-ttl=0 && + mkdir ttlcache forevercache && full=$(git -C repos/rob rev-parse HEAD) && - cgit_rc ttlrc "url=rob/refs/&id=$full" >tmp && + cgit_ok ttlrc "url=rob/refs/&id=$full" >tmp && + cgit_ok foreverrc "url=rob/refs/&id=$full" >tmp && git -C repos/rob tag later HEAD && - cgit_rc ttlrc "url=rob/refs/&id=$full" >tmp && - grep ">later<" tmp + cgit_ok ttlrc "url=rob/refs/&id=$full" >tmp && + test_grep ">later<" tmp && + cgit_ok foreverrc "url=rob/refs/&id=$full" >tmp && + test_grep "" tmp && + test_grep ! ">later<" tmp ' test_expect_success 'the diff caps hold when the path names a directory' ' -- cgit 2.12.1