Browse code

Wrap exercises with master script, with logs, and move common variables.

Todd Willey authored on 2011/11/04 23:31:37
Showing 4 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,24 @@
0
+#!/usr/bin/env bash
1
+
2
+# Run everything in the exercises/ directory that isn't explicitly disabled
3
+
4
+# comma separated list of script basenames to skip
5
+# to refrain from exercising euca.sh use SKIP_EXERCISES=euca
6
+SKIP_EXERCISES=${SKIP_EXERCISES:-""}
7
+
8
+EXERCISE_DIR=$(dirname "$0")/exercises
9
+basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done)
10
+
11
+for script in $basenames ; do
12
+    if [[ "$SKIP_EXERCISES" =~ $script ]] ; then
13
+        echo SKIPPING $script
14
+    else
15
+        echo Running $script
16
+        $EXERCISE_DIR/$script.sh 2> $script.log
17
+        if [[ $? -ne 0 ]] ; then
18
+            echo FAILED.  See $script.log
19
+        else
20
+            rm $script.log
21
+        fi
22
+    fi
23
+done
... ...
@@ -21,9 +21,6 @@ pushd $(cd $(dirname "$0")/.. && pwd)
21 21
 source ./openrc
22 22
 popd
23 23
 
24
-# Max time till the vm is bootable
25
-BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
26
-
27 24
 # find a machine image to boot
28 25
 IMAGE=`euca-describe-images | grep machine | cut -f2`
29 26
 
... ...
@@ -84,15 +84,6 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP
84 84
 # Waiting for boot
85 85
 # ----------------
86 86
 
87
-# Max time to wait while vm goes from build to active state
88
-ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10}
89
-
90
-# Max time till the vm is bootable
91
-BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
92
-
93
-# Max time to wait for proper association and dis-association.
94
-ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10}
95
-
96 87
 # check that the status is active within ACTIVE_TIMEOUT seconds
97 88
 if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $NAME | grep status | grep -q ACTIVE; do sleep 1; done"; then
98 89
     echo "server didn't become active!"
... ...
@@ -49,3 +49,11 @@ export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete}
49 49
 # set log level to DEBUG (helps debug issues)
50 50
 # export NOVACLIENT_DEBUG=1
51 51
 
52
+# Max time till the vm is bootable
53
+export BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
54
+
55
+# Max time to wait while vm goes from build to active state
56
+export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10}
57
+
58
+# Max time to wait for proper IP association and dis-association.
59
+export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10}