From 5653eedac41a15b30d7a2a5bb66b514fa0657811 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 2 Jul 2013 00:00:02 +0200 Subject: [PATCH] Fix vagrant test setup --- tests/run_vagrant | 15 +++++++++++++-- tests/test_deploy | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/run_vagrant b/tests/run_vagrant index eadf3cb4f..929cfda7b 100755 --- a/tests/run_vagrant +++ b/tests/run_vagrant @@ -1,7 +1,8 @@ #!/bin/bash SELF=`which $0` -VAGRANT_SSH_PORT=${$VAGRANT_SSH_PORT:-"2222"} -PUBLIC_KEY=${PUBLIC_KEY:-"~/.ssh/id_rsa.pub"} +VAGRANT_SSH_PORT=${VAGRANT_SSH_PORT:-"2222"} +PUBLIC_KEY=${PUBLIC_KEY:-"$HOME/.ssh/id_rsa.pub"} +FORWARDED_PORT=${FORWARDED_PORT:-":8080"} indent() { sed "s/^/ /"; } if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then echo "-----> Configuring SSH to use $VAGRANT_SSH_PORT for dokku.me..." @@ -11,4 +12,14 @@ if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then fi echo "-----> Ensuring Vagrant is running..." cd "$(dirname $SELF)/.." && vagrant up | indent +cd "$(dirname $SELF)" + +echo "-----> Installing SSH public keys..." cat $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo gitreceive upload-key test" +cat $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku test" + +for app_path in apps/*; do + app=$(basename $app_path) + echo "-----> Running test deploy of $app..." + ./test_deploy $app_path dokku.me $FORWARDED_PORT +done diff --git a/tests/test_deploy b/tests/test_deploy index ad5eda36d..165f72b7b 100755 --- a/tests/test_deploy +++ b/tests/test_deploy @@ -1,6 +1,6 @@ #!/bin/bash set -e -SELF=`which $0`; APP="$1"; TARGET="$2" +SELF=`which $0`; APP="$1"; TARGET="$2"; FORWARDED_PORT="$3" TMP=$(mktemp -d -t "$TARGET.XXXXX") trap "rm -rf $TMP" EXIT rmdir $TMP && cp -r $(dirname $SELF)/$APP $TMP @@ -13,7 +13,7 @@ git commit -m 'initial commit' REPO="test-$(basename $APP)-$RANDOM" git remote add target git@$TARGET:$REPO git push target master -URL=$(ssh dokku@$TARGET url $REPO) +URL=$(ssh dokku@$TARGET url $REPO)$FORWARDED_PORT sleep 2 ./check_deploy $URL && echo "-----> Deploy success!" || { sleep 4