summaryrefslogtreecommitdiffstats
path: root/tests/functions-common
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2017-01-27 06:34:06 +0000
committerRyota MIBU <r-mibu@cq.jp.nec.com>2017-01-31 09:14:31 +0000
commitc9d0d2c9fc16f2e989444bc4d7d8fab8060433ba (patch)
tree210bc9562ae3bd550ff9d87544b8bc657e032e1f /tests/functions-common
parentee4ef36ad0d93ecce542429d49ea368b39940ef9 (diff)
improve cleanup() in run.sh
- make sure all hosts are unset force_down flag - load all functions for inspector and installer first in order to avoid 'command not found' error - also, print VM if it has error state Change-Id: If56cba201e1a5f3669a97ffb3d28b3c55c7cdb58 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
Diffstat (limited to 'tests/functions-common')
-rw-r--r--tests/functions-common17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/functions-common b/tests/functions-common
index db2565a3..08d489e5 100644
--- a/tests/functions-common
+++ b/tests/functions-common
@@ -70,3 +70,20 @@ function die_if_not_set {
$xtrace
}
+# Wait until the condition is met.
+# wait_until condition timeout interval
+function wait_until {
+ local condition="$1"
+ local timeout=$2
+ local interval=$3
+
+ while eval ${condition}
+ do
+ sleep ${interval}
+ timeout=$((${timeout} - ${interval}))
+ if [[ ${timeout} < 0 ]]; then
+ err $LINENO "timed out ($condition)..."
+ return 1
+ fi
+ done
+}