Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Key the cached scan on every setting it uses
Two cgitrc files sharing a cache-root read one list, so strict-export
and trust-scan-config set in one applied to the other, and a changed
setting stayed stale until the list expired. The first request after
an upgrade scans again, and the files under the old names are never
read.
Diffstat (limited to 'tests/t0003-cache.sh')
| -rwxr-xr-x | tests/t0003-cache.sh | 22 |
1 file changed, 19 insertions, 3 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index d247ae4..e63efa0 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -355,9 +355,9 @@ test_expect_success 'a slot lock that cannot take its key is let go' ' test_dir_is_empty cache3 ' -# A scan is cached in a file named after the hash of its path, so a first -# scan finds out what that name is. The index page is left uncached, which -# makes each request read the list afresh. +# A scan is cached in a file named after a hash of its path and settings, so +# a first scan finds out what that name is. The index page is left uncached, +# which makes each request read the list afresh. test_expect_success 'set up a cached scan of two repositories' ' mkrepo scanned/one 1 && mkrepo scanned/two 1 && @@ -418,4 +418,20 @@ test_expect_success 'a stale lock file reaches neither the scan nor a slot' ' ! grep "STALE-TAIL" replay.out ' +# The cached list is read back as trusted config, so a config that would +# scan differently keeps a list of its own in the same cache-root, here one +# that takes only the repositories carrying an export marker. +test_expect_success 'a config that scans differently keeps its own list' ' + touch scanned/one/.git/export-ok && + { + echo "strict-export=export-ok" && + cat scanrc + } >strictrc && + cgit_rc scanrc "url=" >all.out && + cgit_rc strictrc "url=" >strict.out && + grep ">two</a>" all.out && + grep ">one</a>" strict.out && + ! grep ">two</a>" strict.out +' + test_done |
