diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Keep error pages out of the cache
Diffstat (limited to '')
-rwxr-xr-xtests/t0020-validate-cache.sh14
1 file changed, 14 insertions, 0 deletions
diff --git a/tests/t0020-validate-cache.sh b/tests/t0020-validate-cache.sh
index 0cf7433..feb6275 100755
--- a/tests/t0020-validate-cache.sh
+++ b/tests/t0020-validate-cache.sh
@@ -154,4 +154,18 @@ test_expect_success 'an ordinary key still fills a slot' '
test_line_count = 1 key.slots
'
+# An error page reports a condition the repository may grow out of, and a
+# request pinned to an object id would cache it under the never-expiring
+# static ttl. Asking for a commit that does not exist yet must therefore
+# leave nothing behind, or the real page could never appear once it does.
+test_expect_success 'an error page leaves no slot behind' '
+ rm -rf cache3 && mkdir cache3 &&
+ CGIT_CONFIG="$PWD/bigkeyrc" \
+ QUERY_STRING="url=bigpage/commit/&id=0123456789abcdef0123456789abcdef01234567" \
+ cgit >error.out &&
+ grep "Bad commit reference" error.out &&
+ ls cache3 >error.slots &&
+ test_line_count = 0 error.slots
+'
+
test_done