From 7a08b450b80e8efb81b980a87e06ae65bb62f753 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:56:59 -0700 Subject: Move the later tests to the config writers The one-line request wrappers go with them. Configs with several repositories, a key out of place on purpose, the cache on or no repository of their own stay written out. --- tests/t0303-robustness.sh | 219 +++++++++++++++++++--------------------------- 1 file changed, 90 insertions(+), 129 deletions(-) (limited to 'tests/t0303-robustness.sh') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 5348b43..f1ae9cd 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -10,17 +10,9 @@ test_description='Check the audit regressions' test_expect_success 'set up a repository and a config to vary' ' mkrepo repos/rob 3 && sha=$(git -C repos/rob rev-parse HEAD~1) && - { - echo "virtual-root=/" && - echo "cache-size=0" && - echo "snapshots=tar.gz" && - echo "repo.url=rob" && - echo "repo.path=$PWD/repos/rob/.git" - } >robrc + cgitrc_repo robrc rob snapshots=tar.gz ' -robq() { CGIT_CONFIG="$PWD/robrc" QUERY_STRING="$1" cgit; } - test_expect_success 'a repository without a path answers 404' ' { echo "virtual-root=/" && @@ -31,7 +23,7 @@ test_expect_success 'a repository without a path answers 404' ' } >nopathrc && for r in nopath emptypath do - CGIT_CONFIG="$PWD/nopathrc" QUERY_STRING="url=$r/log/" cgit >tmp && + cgit_rc nopathrc "url=$r/log/" >tmp && grep "^Status: 404 Not Found" tmp && grep "Failed to open $r: Not a valid git repository" tmp || return 1 done @@ -42,7 +34,7 @@ test_expect_success 'a repository without a path answers 404' ' test_expect_success 'a repository without a path has no age on the index' ' mkdir -p "(null)/refs/heads" && >"(null)/refs/heads/master" && - CGIT_CONFIG="$PWD/nopathrc" QUERY_STRING="url=" cgit >tmp && + cgit_rc nopathrc "url=" >tmp && grep "" tmp && ! grep "