diff --git a/exercise.sh b/exercise.sh new file mode 100755 index 0000000..de906f2 --- /dev/null +++ b/exercise.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Run everything in the exercises/ directory that isn't explicitly disabled + +# comma separated list of script basenames to skip +# to refrain from exercising euca.sh use SKIP_EXERCISES=euca +SKIP_EXERCISES=${SKIP_EXERCISES:-""} + +EXERCISE_DIR=$(dirname "$0")/exercises +basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done) + +for script in $basenames ; do + if [[ "$SKIP_EXERCISES" =~ $script ]] ; then + echo SKIPPING $script + else + echo Running $script + $EXERCISE_DIR/$script.sh 2> $script.log + if [[ $? -ne 0 ]] ; then + echo FAILED. See $script.log + else + rm $script.log + fi + fi +done diff --git a/exercises/euca.sh b/exercises/euca.sh index 0cb5fea..0d48c93 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -21,9 +21,6 @@ pushd $(cd $(dirname "$0")/.. && pwd) source ./openrc popd -# Max time till the vm is bootable -BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} - # find a machine image to boot IMAGE=`euca-describe-images | grep machine | cut -f2` diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index edf784c..5c38430 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -84,15 +84,6 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP # Waiting for boot # ---------------- -# Max time to wait while vm goes from build to active state -ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10} - -# Max time till the vm is bootable -BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} - -# Max time to wait for proper association and dis-association. -ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10} - # check that the status is active within ACTIVE_TIMEOUT seconds if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $NAME | grep status | grep -q ACTIVE; do sleep 1; done"; then echo "server didn't become active!" diff --git a/openrc b/openrc index 324780b..db1a7d1 100644 --- a/openrc +++ b/openrc @@ -49,3 +49,11 @@ export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete} # set log level to DEBUG (helps debug issues) # export NOVACLIENT_DEBUG=1 +# Max time till the vm is bootable +export BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} + +# Max time to wait while vm goes from build to active state +export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10} + +# Max time to wait for proper IP association and dis-association. +export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10}