diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2016-06-16 17:34:24 +0800 |
---|---|---|
committer | wenjuan dong <dong.wenjuan@zte.com.cn> | 2016-06-30 02:54:50 +0000 |
commit | 2d55d6e7efc9f02a9de10a36627bec345e856c5d (patch) | |
tree | 24a1aa4e7ba1439362bc1c9ff1af9d3d85cfc726 | |
parent | 59fb6475a39de162a8c72d8904a494eabe6d39b4 (diff) |
add timeout handle
If create instance don't success, it will have a
endless loop for waiting instance to change to
`active` state.
Change-Id: I6eff3cbaefaf1ba7e30ae7fddcec62ac5c1544de
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
-rwxr-xr-x | tests/run.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/run.sh b/tests/run.sh index 56bacca7..d7240d24 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -166,12 +166,17 @@ stop_consumer() { wait_for_vm_launch() { echo "waiting for vm launch..." - while true + count=0 + while [[ ${count} -lt 60 ]] do state=$(nova list | grep " $VM_NAME " | awk '{print $6}') [[ "$state" == "ACTIVE" ]] && return 0 + [[ "$state" == "ERROR" ]] && echo "vm state is ERROR" && exit 1 + count=$(($count+1)) sleep 1 done + echo "ERROR: time out while waiting for vm launch" + exit 1 } inject_failure() { |