Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0003-cache.sh | 25 |
1 file changed, 25 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index 5e8245b..9ae13ac 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -230,6 +230,31 @@ test_expect_success 'pages following a branch take the dynamic ttl' ' test_line_count = 2 summary.slots ' +# Only a full object id names a page that can never change, so a page pinned +# to one alone takes the static ttl, which by default never expires. An +# abbreviation or a branch name, in either id, can come to mean another +# commit. +test_expect_success 'only a page pinned to full ids takes the static ttl' ' + rm -rf cache3 && mkdir cache3 && + { + echo "cache-dynamic-ttl=0" && + cat bigkeyrc + } >staticrc && + first=$(git -C repos/bigpage rev-parse HEAD~1) && + short=$(git -C repos/bigpage rev-parse --short HEAD~1) && + for query in "commit/&id=$short" "commit/&id=master" "diff/&id=$first&id2=$short" "diff/&id=master&id2=$first" + do + cgit_ok staticrc "url=bigpage/$query" >/dev/null || return 1 + done && + test_dir_is_empty cache3 && + cgit_ok staticrc "url=bigpage/commit/&id=$first" >/dev/null && + ls cache3 >static.slots && + test_line_count = 1 static.slots && + cgit_ok staticrc "url=bigpage/diff/&id=$first&id2=$first" >/dev/null && + ls cache3 >static.slots && + test_line_count = 2 static.slots +' + # A write into the lock file that fails on the page's last flush has to end # as one that fails mid page does, with the fill abandoned and the page # delivered from the lock file, rather than in a blank response. The limit |
