Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep a scan with a negative ttl for good
"The cache" promises that a negative ttl never expires, but no age was
ever below a negative cache-scan-ttl, so every request started a
background rescan.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0003-cache.sh | 21 |
1 file changed, 21 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index e63efa0..fa72015 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -434,4 +434,25 @@ test_expect_success 'a config that scans differently keeps its own list' ' ! grep ">two</a>" strict.out ' +# A negative ttl never expires, so a list however old is served and kept. A +# rebuild runs in a child holding the request's copy of fd 9, so cat reaching +# the end of that pipe means any rebuild is done, as the positive ttl after +# it shows. +test_expect_success 'a negative cache-scan-ttl never expires the list' ' + { + echo "cache-scan-ttl=-1" && + cat scanrc + } >foreverrc && + { + echo "repo.url=kept" && + echo "repo.path=$PWD/scanned/one/.git" + } >>"cache5/$scanned_rc" && + touch -t 200001010000 "cache5/$scanned_rc" && + cgit_rc foreverrc "url=" 9>&1 >forever.out | cat && + grep ">kept</a>" forever.out && + grep "^repo.url=kept$" "cache5/$scanned_rc" && + cgit_rc scanrc "url=" 9>&1 >/dev/null | cat && + ! grep "^repo.url=kept$" "cache5/$scanned_rc" +' + test_done |
