[sheepdog] [PATCH v2 6/6] test: fix 006
Liu Yuan
namei.unix at gmail.com
Mon Aug 13 13:25:39 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
We should wait all the sheep to join completion before issuing any collie
command
- add a helper _wait_for_sheep(nr_sheep)
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
tests/006 | 2 +-
tests/008 | 7 +------
tests/common.rc | 11 +++++++++++
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/tests/006 b/tests/006
index 024804d..5b6ee51 100755
--- a/tests/006
+++ b/tests/006
@@ -25,7 +25,7 @@ for i in `seq 1 9`; do
$SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
done
-sleep 1
+_wait_for_sheep "10"
echo check whether all nodes have the same cluster info
for i in `seq 0 9`; do
diff --git a/tests/008 b/tests/008
index a78a156..711fbd5 100755
--- a/tests/008
+++ b/tests/008
@@ -17,12 +17,7 @@ for i in `seq 0 7`; do
$SHEEP $STORE/$i -z $i -p 700$i -c $DRIVER
done
-while true; do
- sleep 2
- if [ $($COLLIE node list | wc -l) -eq 9 ]; then
- break
- fi
-done
+_wait_for_sheep "8"
$COLLIE cluster format -c 3
sleep 1
diff --git a/tests/common.rc b/tests/common.rc
index 7e8fa0f..8c33e4f 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -143,5 +143,16 @@ _wait_for_collie()
done
}
+# wait all sheep to join completely
+_wait_for_sheep()
+{
+ while true; do
+ sleep 2
+ if [ $($COLLIE node list | wc -l) -eq $(($1+1)) ]; then
+ break
+ fi
+ done
+}
+
# make sure this script returns success
/bin/true
--
1.7.10.2
More information about the sheepdog
mailing list