- Catch a special exit signal 55 to notify that we want to skip an
excercise.
- Move is_enabled_service to functions.
- Fix bug 928390.
Change-Id: Iebf7a6f30a0f305a2a70173fb6b988bc07e34292
| ... | ... |
@@ -136,6 +136,10 @@ These scripts are executed serially by ``exercise.sh`` in testing situations. |
| 136 | 136 |
FLOATING_IP=`euca-allocate-address | cut -f2` |
| 137 | 137 |
die_if_not_set FLOATING_IP "Failure allocating floating IP" |
| 138 | 138 |
|
| 139 |
+* If you want an exercise to be skipped when for example a service wasn't |
|
| 140 |
+ enabled for the exercise to be run, you can exit your exercise with the |
|
| 141 |
+ special exitcode 55 and it will be detected as skipped. |
|
| 142 |
+ |
|
| 139 | 143 |
* The exercise scripts should only use the various OpenStack client binaries to |
| 140 | 144 |
interact with OpenStack. This specifically excludes any ``*-manage`` tools |
| 141 | 145 |
as those assume direct access to configuration and databases, as well as direct |
| ... | ... |
@@ -32,7 +32,10 @@ for script in $basenames; do |
| 32 | 32 |
echo Running $script |
| 33 | 33 |
echo "=====================================================================" |
| 34 | 34 |
$EXERCISE_DIR/$script.sh |
| 35 |
- if [[ $? -ne 0 ]] ; then |
|
| 35 |
+ exitcode=$? |
|
| 36 |
+ if [[ $exitcode == 55 ]]; then |
|
| 37 |
+ skips="$skips $script" |
|
| 38 |
+ elif [[ $exitcode -ne 0 ]] ; then |
|
| 36 | 39 |
failures="$failures $script" |
| 37 | 40 |
else |
| 38 | 41 |
passes="$passes $script" |
| ... | ... |
@@ -115,6 +115,28 @@ function git_clone {
|
| 115 | 115 |
} |
| 116 | 116 |
|
| 117 | 117 |
|
| 118 |
+# is_service_enabled() checks if the service(s) specified as arguments are |
|
| 119 |
+# enabled by the user in **ENABLED_SERVICES**. |
|
| 120 |
+# |
|
| 121 |
+# If there are multiple services specified as arguments the test performs a |
|
| 122 |
+# boolean OR or if any of the services specified on the command line |
|
| 123 |
+# return true. |
|
| 124 |
+# |
|
| 125 |
+# There is a special cases for some 'catch-all' services:: |
|
| 126 |
+# **nova** returns true if any service enabled start with **n-** |
|
| 127 |
+# **glance** returns true if any service enabled start with **g-** |
|
| 128 |
+# **quantum** returns true if any service enabled start with **q-** |
|
| 129 |
+function is_service_enabled() {
|
|
| 130 |
+ services=$@ |
|
| 131 |
+ for service in ${services}; do
|
|
| 132 |
+ [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
|
|
| 133 |
+ [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
|
|
| 134 |
+ [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
|
|
| 135 |
+ [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
|
|
| 136 |
+ done |
|
| 137 |
+ return 1 |
|
| 138 |
+} |
|
| 139 |
+ |
|
| 118 | 140 |
|
| 119 | 141 |
# Test if the named environment variable is set and not zero length |
| 120 | 142 |
# is_set env-var |
| ... | ... |
@@ -151,4 +173,4 @@ function trueorfalse() {
|
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 | 153 |
# Restore xtrace |
| 154 |
-$XTRACE |
|
| 155 | 154 |
\ No newline at end of file |
| 155 |
+$XTRACE |
| ... | ... |
@@ -268,30 +268,6 @@ function read_password {
|
| 268 | 268 |
set -o xtrace |
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 |
-# is_service_enabled() checks if the service(s) specified as arguments are |
|
| 272 |
-# enabled by the user in **ENABLED_SERVICES**. |
|
| 273 |
-# |
|
| 274 |
-# If there are multiple services specified as arguments the test performs a |
|
| 275 |
-# boolean OR or if any of the services specified on the command line |
|
| 276 |
-# return true. |
|
| 277 |
-# |
|
| 278 |
-# There is a special cases for some 'catch-all' services:: |
|
| 279 |
-# **nova** returns true if any service enabled start with **n-** |
|
| 280 |
-# **glance** returns true if any service enabled start with **g-** |
|
| 281 |
-# **quantum** returns true if any service enabled start with **q-** |
|
| 282 |
- |
|
| 283 |
-function is_service_enabled() {
|
|
| 284 |
- services=$@ |
|
| 285 |
- for service in ${services}; do
|
|
| 286 |
- [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
|
|
| 287 |
- [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
|
|
| 288 |
- [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
|
|
| 289 |
- [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
|
|
| 290 |
- done |
|
| 291 |
- return 1 |
|
| 292 |
-} |
|
| 293 |
- |
|
| 294 |
- |
|
| 295 | 271 |
# Nova Network Configuration |
| 296 | 272 |
# -------------------------- |
| 297 | 273 |
|