diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Answer 404 for a repository whose path is missing
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0205-config.sh23
1 file changed, 21 insertions, 2 deletions
diff --git a/tests/t0205-config.sh b/tests/t0205-config.sh
index 1a4f5d0..26231af 100755
--- a/tests/t0205-config.sh
+++ b/tests/t0205-config.sh
@@ -3,8 +3,9 @@
# Checks what the configuration parser reports on stderr. A key it does not
# know, a repo key before any repository and a filter set by a scanned
# repository without trust-scan-filters are each ignored with a warning naming
-# the key, a repo filter in the main cgitrc passes without one, and a config
-# cgit fully understands stays silent.
+# the key, a repo filter in the main cgitrc passes without one, a repository
+# whose path is missing answers 404 on every page, and a config cgit fully
+# understands stays silent.
test_description='Check configuration diagnostics'
. ./setup.sh
@@ -70,6 +71,24 @@ test_expect_success 'a repo filter in the main cgitrc needs no flag' '
! grep "about-filter" err
'
+test_expect_success 'a repository whose path is missing answers 404' '
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=1021" &&
+ echo "cache-root=$PWD/gone-cache" &&
+ echo "repo.url=gone" &&
+ echo "repo.path=$PWD/no/such/repo/.git"
+ } >gonerc &&
+ mkdir -p gone-cache &&
+ for page in "" log/ commit/ "tag/&h=x" atom/ plain/f
+ do
+ CGIT_CONFIG="$PWD/gonerc" QUERY_STRING="url=gone/$page" cgit >tmp 2>err &&
+ grep "^Status: 404 Not Found" tmp &&
+ grep "Failed to open gone: No such file or directory" tmp || return 1
+ done &&
+ test -z "$(ls gone-cache)"
+'
+
test_expect_success 'a fully understood config stays silent' '
cgit_url "foo/" >tmp 2>err &&
grep "Status: 200" tmp &&