diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Cache every branch page under cache-dynamic-ttl
The dynamic ttl only applied when the url named a branch with h=, so the log, tree and refs of the default branch, which never carry one, fell back to cache-summary-ttl. The manual already gives each ttl the scope the code now uses.
Diffstat (limited to 'tests/t0003-cache.sh')
-rwxr-xr-xtests/t0003-cache.sh19
1 file changed, 19 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh
index 3e2a971..bf38fbb 100755
--- a/tests/t0003-cache.sh
+++ b/tests/t0003-cache.sh
@@ -212,4 +212,23 @@ test_expect_success 'an expired slot is dropped when its refill is too large' '
test_line_count = 0 refill.slots
'
+# The summary page keeps a ttl of its own, while every other page that follows
+# a branch rather than a pinned id takes cache-dynamic-ttl, whether or not its
+# url names the branch.
+test_expect_success 'pages following a branch take the dynamic ttl' '
+ rm -rf cache3 && mkdir cache3 &&
+ {
+ echo "cache-dynamic-ttl=0" &&
+ cat bigkeyrc
+ } >dynamicrc &&
+ CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/log/" cgit >/dev/null &&
+ CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/log/&h=master" cgit >/dev/null &&
+ ls cache3 >dynamic.slots &&
+ test_line_count = 0 dynamic.slots &&
+ CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/" cgit >/dev/null &&
+ CGIT_CONFIG="$PWD/dynamicrc" QUERY_STRING="url=bigpage/summary/" cgit >/dev/null &&
+ ls cache3 >summary.slots &&
+ test_line_count = 2 summary.slots
+'
+
test_done