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_join(nr_sheep) Signed-off-by: Liu Yuan <tailai.ly at taobao.com> --- tests/006 | 2 +- tests/008 | 7 +------ tests/common.rc | 10 ++++++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/006 b/tests/006 index 024804d..22fc4cd 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_join "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..a2ff208 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_join "8" $COLLIE cluster format -c 3 sleep 1 diff --git a/tests/common.rc b/tests/common.rc index 0b58fcb..f01f626 100644 --- a/tests/common.rc +++ b/tests/common.rc @@ -142,5 +142,15 @@ _wait_for_collie() done } +_wait_for_sheep_join() +{ + 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 |