diff options
author | 2012-02-21 10:56:23 +0530 | |
---|---|---|
committer | 2012-02-22 06:29:13 +0530 | |
commit | 9dd191ef7f4afd09b67f5657afc297d8e3f537b1 (patch) | |
tree | 5f4ed1ee9da4a524269a48ec6ca21ee1cd031a7a | |
parent | add a standalone test for gl-system-install (diff) | |
download | gitolite-gentoo-9dd191ef7f4afd09b67f5657afc297d8e3f537b1.tar.gz gitolite-gentoo-9dd191ef7f4afd09b67f5657afc297d8e3f537b1.tar.bz2 gitolite-gentoo-9dd191ef7f4afd09b67f5657afc297d8e3f537b1.zip |
fix http install (broken by d08aca); add a quick smoke test
-rwxr-xr-x | src/gl-setup | 2 | ||||
-rw-r--r-- | t/smart-http-smoke-test/README | 12 | ||||
-rwxr-xr-x | t/smart-http-smoke-test/install | 49 | ||||
-rwxr-xr-x | t/smart-http-smoke-test/t01 | 91 |
4 files changed, 153 insertions, 1 deletions
diff --git a/src/gl-setup b/src/gl-setup index b00560a..ca815f8 100755 --- a/src/gl-setup +++ b/src/gl-setup @@ -124,7 +124,7 @@ touch $HOME/.ssh/authorized_keys gl-compile-conf -q # setup push-to-admin -[ -n "$pubkey_file" ] && ( +[ -n "$pubkey_file" ] || [ -n "$GITOLITE_HTTP_HOME" ] && ( cd $HOME; cd $REPO_BASE/gitolite-admin.git GIT_WORK_TREE=$GL_ADMINDIR; export GIT_WORK_TREE git add conf/gitolite.conf keydir diff --git a/t/smart-http-smoke-test/README b/t/smart-http-smoke-test/README new file mode 100644 index 0000000..09d2178 --- /dev/null +++ b/t/smart-http-smoke-test/README @@ -0,0 +1,12 @@ +quick smoke test for smart http mode. + + - tested on fedora 16; YDMV + - tests are designed for "just installed" case; running them twice will fail + +step 1: as root, run + + t/smart-http-smoke-test/install + +step 2: as any normal user, run + + prove t/smart-http-smoke-test/t01 diff --git a/t/smart-http-smoke-test/install b/t/smart-http-smoke-test/install new file mode 100755 index 0000000..7fa3d0a --- /dev/null +++ b/t/smart-http-smoke-test/install @@ -0,0 +1,49 @@ +#!/bin/bash + +die() { echo "$@"; exit 1; } + +id | grep '=0(root)' || die "you must run this as root" +umask 0022 + +cd ~apache +rm -rf gitolite-home +mkdir gitolite-home +export GITOLITE_HTTP_HOME +GITOLITE_HTTP_HOME=/var/www/gitolite-home +PATH=$PATH:$GITOLITE_HTTP_HOME/bin + +cd gitolite-home +git clone /tmp/gitolite.git gitolite-source + +cd gitolite-source +src/gl-system-install $GITOLITE_HTTP_HOME/bin $GITOLITE_HTTP_HOME/share/gitolite/conf $GITOLITE_HTTP_HOME/share/gitolite/hooks + +echo '$ENV{GIT_HTTP_BACKEND} = "/usr/libexec/git-core/git-http-backend";' > 1 +echo '$ENV{PATH} .= ":$ENV{GITOLITE_HTTP_HOME}/bin";' >> 1 +cat /var/www/gitolite-home/share/gitolite/conf/example.gitolite.rc >> 1 +\mv 1 /var/www/gitolite-home/share/gitolite/conf/example.gitolite.rc + +gl-setup -q tester + +chown -R apache.apache $GITOLITE_HTTP_HOME + +cat <<EOF1 > /etc/httpd/conf.d/gitolite.conf +SetEnv GIT_PROJECT_ROOT /var/www/gitolite-home/repositories +ScriptAlias /git/ /var/www/gitolite-home/bin/gl-auth-command/ +ScriptAlias /gitmob/ /var/www/gitolite-home/bin/gl-auth-command/ +SetEnv GITOLITE_HTTP_HOME /var/www/gitolite-home +SetEnv GIT_HTTP_EXPORT_ALL + +<Location /git> + AuthType Basic + AuthName "Private Git Access" + Require valid-user + AuthUserFile /tmp/gitolite-http-authuserfile +</Location> +EOF1 + +htpasswd -bc /tmp/gitolite-http-authuserfile tester tester +map "htpasswd -b /tmp/gitolite-http-authuserfile % %" u{1..6} + +service httpd restart + diff --git a/t/smart-http-smoke-test/t01 b/t/smart-http-smoke-test/t01 new file mode 100755 index 0000000..d5f5d82 --- /dev/null +++ b/t/smart-http-smoke-test/t01 @@ -0,0 +1,91 @@ +#!/bin/bash + +die() { echo "$@"; exit 1; } + +# git clone `url u1 r1` +url() { + echo http://$1:$1@localhost/git/$2.git +} + +# `cmd sitaram info` +cmd() { + c="curl http://$1:$1@localhost/git" + shift + c="$c/$1" + shift + + if [ -n "$1" ] + then + c="$c?$1" + shift + fi + while [ -n "$1" ] + do + c="$c+$1" + shift + done + + echo $c +} + +export tmp=$(mktemp -d); +trap "rm -rf $tmp" 0; +cd $tmp + +tsh "plan 29" + +tsh " + ## ls-remote tester admin + git ls-remote `url tester gitolite-admin` + ok + /HEAD/ + /refs.heads.master/ + ## clone + git clone `url tester gitolite-admin` + ok + /Cloning into/ + ls -al gitolite-admin/conf + /gitolite.conf/ +" || die "step 1" + +cd gitolite-admin +echo repo t2 >> conf/gitolite.conf +echo 'RW+ = u1 u2' >> conf/gitolite.conf + +tsh " + ## add, commit, push + git add conf/gitolite.conf + ok + !/./ + git commit -m t2 + ok + /1 file.*changed/ + git push + ok + /creating t2/ or die run this on a fresh install please... + /Initialized.*var.www.gitolite-home.repositories.t2.git/ + /To http:..tester:tester.localhost.git.gitolite-admin.git/ + /master -. master/ + ## various ls-remotes + git ls-remote `url u1 gitolite-admin` + !ok + /DENIED to u1/ + git ls-remote `url u1 t2` + ok + !/./ + git ls-remote `url u2 t2` + ok + !/./ + git ls-remote `url u3 t2` + !ok + /DENIED to u3/ + ## push to u1:t2 + git push `url u1 t2` master:master + ok + /To http:..u1:u1.localhost.git.t2.git/ + /master -. master/ + git ls-remote `url u2 t2` + ok + /HEAD/ + /refs.heads.master/ +" || die "step 2" |