From 6b695644b0c514e736af88bf70b1a0838dd6c46e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 6 Oct 2013 10:15:36 +0100 Subject: Start test suite over from scratch Remove static test key for test user. --- git.liw.fi.sh | 59 ++++++++++++++++++++--------------------------------------- 1 file changed, 20 insertions(+), 39 deletions(-) (limited to 'git.liw.fi.sh') diff --git a/git.liw.fi.sh b/git.liw.fi.sh index 6f1163c..f4245f1 100644 --- a/git.liw.fi.sh +++ b/git.liw.fi.sh @@ -1,14 +1,7 @@ -gitano() -{ - local keyname="$1" - shift - if [ "$keyname" = "liw" ] - then - ssh "$GITANO" "$@" - else - SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$keyname.key" "$GITANO" "$@" - fi -} +# Shell library for running git.liw.fi ACL tests. + + +# This is handy for giving an error message and aborting. die() { @@ -16,40 +9,28 @@ die() exit 1 } -attempt() -{ - if "$@" > "$DATADIR/attempt.stdout" 2> "$DATADIR/attempt.stderr" - then - echo 0 > "$DATADIR/attempt.exit" - else - echo $? > "$DATADIR/attempt.exit" - fi -} -clone_using_git() +# Run gitano on the server using a desired ssh key. The key is +# either the admin key (i.e., they key of whoever invoked the +# test suite), or a test key we've created in $DATADIR. + +run_gitano_as() { - local dir="$1/$2" - local url="git://$GITHOST/$2" - rm -rf "$dir" - mkdir -p "$dir" - if [ "$1" = liw ] + local keyname="$1" + shift + if [ "$keyname" = "admin" ] then - git clone "$url" "$dir" + ssh "$GITANO@$GITHOST" "$@" else - SSH_AUTH_SOCK= git clone "$url" "$dir" + SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$DATADIR/$keyname.key" \ + "$GITANO@GITHOST" "$@" fi } -clone_using_ssh() + +# Does a user exist on the server? + +user_exists() { - local dir="$1/$2" - local url="ssh://$GITANO/$2" - rm -rf "$dir" - mkdir -p "$dir" - if [ "$1" = liw ] - then - git clone "$url" "$dir" - else - PATH="$SRCDIR:$PATH" git clone "$url" "$dir" - fi + ssh "$GITANO@$GITHOST" user | grep "^$1:" } -- cgit v1.2.1