Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 72 lines (56 sloc) 2.02 KB
#!/bin/sh
# Run this to test a deployment. It ignores SSL, so you can use it regardless
# of whether you're using SSL.
[ "$TREEGIT_USERNAME" = '' ] && echo 'Please specify a TREEGIT_USERNAME' && exit 1
[ "$TREEGIT_DOMAIN_NAME" = '' ] && echo 'Please specify a TREEGIT_DOMAIN_NAME' && exit 1
# Temporary stuff
repo=$(uuidgen)
tmp=$(mktemp -d)
cloneurl="$TREEGIT_DOMAIN_NAME/clone/$repo.git"
catch() {
[ "$?" = '0' ] && passed=true
if $passed
then
echo -ne '\033[32mPassed: '
else
echo -ne '\033[31mFailed: '
fi
echo -ne "\033[0m"
echo $*
passed=false
}
clear
# Quiet, follow redirects, don't check SSL certificates.
alias get="curl -sLk secrets.thomaslevine.com"
get http://$TREEGIT_DOMAIN_NAME/?p=about|grep 'treegit-create' > /dev/null
catch 'I should see a treegit-create function at http://$TREEGIT_DOMAIN_NAME/?p=about.'
ssh $TREEGIT_USERNAME@$TREEGIT_DOMAIN_NAME 'echo hi' > /dev/null
catch 'I should be able to ssh to $TREEGIT_USERNAME@$TREEGIT_DOMAIN_NAME'
ssh $TREEGIT_USERNAME@$TREEGIT_DOMAIN_NAME "treegit-create $repo" > /dev/null
catch 'I should be able to create a repository on the server.'
sleep 2s
get http://$TREEGIT_DOMAIN_NAME/|grep $repo > /dev/null
catch "I should see the repository on http://$TREEGIT_DOMAIN_NAME."
(
cd $tmp > /dev/null
mkdir foo > /dev/null
cd foo > /dev/null
git init > /dev/null
echo bar > baz > /dev/null
git add baz > /dev/null
git commit . -m foobar > /dev/null
git push $TREEGIT_USERNAME@$TREEGIT_DOMAIN_NAME:$repo.git master &> /dev/null
catch 'I should be able to push to the newly-created repository.'
)
get http://$TREEGIT_DOMAIN_NAME/$repo/|grep $cloneurl > /dev/null
catch 'Once I push the repository, I should see the clone url.'
(
cd $tmp
git clone --config http.sslVerify=false http://$cloneurl > /dev/null
catch 'I should be able to clone the repository over http.'
)
echo \
echo 'Clean up:'
echo " rm -Rf $tmp"
echo " ssh $TREEGIT_USERNAME@$TREEGIT_DOMAIN_NAME 'rm -Rf $repo.git'"
echo "I don't run these manually because bugs could be bad."