Diff options
| -rwxr-xr-x | tests/t0003-cache.sh | 31 |
1 file changed, 21 insertions, 10 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index a0cff72..acc9496 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -448,16 +448,17 @@ test_expect_success SANITY 'a refresh that cannot lock serves the expired slot a # A lock file that cannot take the key goes with its lock, rather than # staying behind locked while the page renders uncached. The limit is on -# files, so the log goes through the pipe as well. +# files, so the log and cgit's exit status go through the pipe as well. test_expect_success 'a slot lock that cannot take its key is let go' ' rm -rf cache3 && mkdir cache3 && ( trap "" XFSZ && ulimit -f 0 && - cgit_rc bigkeyrc "url=bigpage/" 2>&1 + { cgit_rc bigkeyrc "url=bigpage/" 2>&1; echo "exit status $?"; } ) | cat >nokey.out && - grep "</html>" nokey.out && - grep "Unable to write .*\.lock" nokey.out && + test_grep "^exit status 0$" nokey.out && + test_grep "</html>" nokey.out && + test_grep "Unable to write .*\.lock" nokey.out && test_dir_is_empty cache3 ' @@ -642,22 +643,32 @@ test_expect_success 'every setting the scan depends on keeps its own list' ' # 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. +# it shows. The ttl is not part of the list's name, so both configs share +# the list, which is scanned afresh here. test_expect_success 'a negative cache-scan-ttl never expires the list' ' { echo "cache-scan-ttl=-1" && cat scanrc } >foreverrc && + rm -f "cache5/$scanned_rc" && + cgit_ok scanrc "url=" >/dev/null && + test_path_is_file "cache5/$scanned_rc" && { 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" + { cgit_rc foreverrc "url=" 9>&1 >forever.out 2>forever.err; echo $? >forever.status; } | cat && + test "$(cat forever.status)" = 0 && + test_must_be_empty forever.err && + test_grep ">kept</a>" forever.out && + test_grep "^repo.url=kept$" "cache5/$scanned_rc" && + { cgit_rc scanrc "url=" 9>&1 >rescan.out 2>rescan.err; echo $? >rescan.status; } | cat && + test "$(cat rescan.status)" = 0 && + test_must_be_empty rescan.err && + test_grep ">kept</a>" rescan.out && + test_grep "^repo.url=one$" "cache5/$scanned_rc" && + test_grep ! "^repo.url=kept$" "cache5/$scanned_rc" ' # A repository the scan found without a description goes into the list |
