From 1e69db8e6e7f17c1278e170bd1410e9fb18210eb Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 8 Oct 2013 19:48:59 +0100 Subject: Verify that cgit shows public repos --- git.liw.fi.sh | 21 +++++++++++++++++++++ git.liw.fi.yarn | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/git.liw.fi.sh b/git.liw.fi.sh index 9f03ff3..6f20266 100644 --- a/git.liw.fi.sh +++ b/git.liw.fi.sh @@ -124,3 +124,24 @@ destroy_repo() { two_step run_gitano_as "$1" destroy "$2" } + + +# Does cgit show a repository? + +cgit_shows() +{ + local tempfile="$(mktemp)" + wget -q -O- "http://$GITHOST/cgi-bin/cgit/cgit.cgi/$1/" \ + > "$tempfile" 2>&1 + if grep 'Repository seems to be empty' "$tempfile" + then + ret=0 + elif grep 'Commit message' "$tempfile" + then + ret=0 + else + ret=1 + fi + rm -f "$tempfile" + return $ret +} diff --git a/git.liw.fi.yarn b/git.liw.fi.yarn index 1e009fb..5c662ee 100644 --- a/git.liw.fi.yarn +++ b/git.liw.fi.yarn @@ -85,6 +85,7 @@ be able to remove the repository. AND admin can clone tstrepo using ssh AND tstusr can see repository tstrepo AND tstusr can clone tstrepo using ssh + AND cgit shows repository tstrepo WHEN tstusr attempts to remove repository tstrepo THEN attempt failed with error matching "You may not destroy repositories you do not own" @@ -95,6 +96,7 @@ be able to remove the repository. AND admin can't clone tstrepo using ssh AND tstusr can't see repository tstrepo AND tstusr can't clone tstrepo using ssh + AND cgit doesn't show repository tstrepo FINALLY remove repository tstrepo on server AND remove user tstusr on server @@ -299,3 +301,19 @@ can try. IMPLEMENTS WHEN (\S+) attempts to remove repository (\S+) attempt destroy_repo "$MATCH_1" "$MATCH_2" + +Cgit access +----------- + +Verify that cgit shows a repository. + + IMPLEMENTS THEN cgit shows repository (\S+) + cgit_shows "$MATCH_1" + +Verify cgit doesn't show a repository. + + IMPLEMENTS THEN cgit doesn't show repository (\S+) + if cgit_shows "$MATCH_1" + then + die "cgi shows $MATCH_1 but shouldn't" + fi -- cgit v1.2.1