[sheepdog] [PATCH] test: fix random spurious failure by using _wait_for_sheep helper

Liu Yuan namei.unix at gmail.com
Wed Sep 5 05:49:18 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/001 |    6 ++++--
 tests/002 |    6 ++++--
 tests/006 |    4 ++--
 tests/009 |    3 ++-
 tests/013 |    2 +-
 tests/015 |    2 +-
 tests/016 |    2 +-
 tests/017 |    2 +-
 8 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/tests/001 b/tests/001
index bfc8d40..1a9b098 100755
--- a/tests/001
+++ b/tests/001
@@ -17,9 +17,10 @@ _cleanup
 
 for i in 0 1; do
     _start_sheep $i
-    sleep 1
 done
 
+_wait_for_sheep 2
+
 # start Sheepdog with two nodes
 $COLLIE cluster format
 
@@ -48,9 +49,10 @@ $COLLIE cluster info -p 7002 | _filter_cluster_info
 # add the other nodes
 for i in 0 1; do
     _start_sheep $i
-    sleep 1
 done
 
+_wait_for_sheep 3
+
 echo check whether all nodes have the same cluster info
 for i in 0 1 2; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info
diff --git a/tests/002 b/tests/002
index 2ea92b9..0644199 100755
--- a/tests/002
+++ b/tests/002
@@ -17,9 +17,10 @@ _cleanup
 
 for i in 0 1 2; do
     _start_sheep $i
-    sleep 1
 done
 
+_wait_for_sheep 3
+
 # start Sheepdog with three nodes
 $COLLIE cluster format
 
@@ -41,9 +42,10 @@ $COLLIE cluster info -p 7002 | _filter_cluster_info
 # add the other nodes
 for i in 0 1; do
     _start_sheep $i
-    sleep 1
 done
 
+_wait_for_sheep 3
+
 echo check whether all nodes have the same cluster info
 for i in 0 1 2; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info
diff --git a/tests/006 b/tests/006
index 95909de..5d4d8bf 100755
--- a/tests/006
+++ b/tests/006
@@ -16,7 +16,7 @@ status=1        # failure is the default!
 _cleanup
 
 _start_sheep 0
-sleep 1
+_wait_for_sheep 1
 
 # start Sheepdog with one node
 $COLLIE cluster format
@@ -27,7 +27,7 @@ for i in `seq 1 9`; do
     _start_sheep $i
 done
 
-_wait_for_sheep "10"
+_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/009 b/tests/009
index ad3d06a..e139524 100755
--- a/tests/009
+++ b/tests/009
@@ -20,7 +20,8 @@ for i in 0 1 2; do
     _start_sheep $i
 done
 
-sleep 1
+_wait_for_sheep 3
+
 $COLLIE cluster format -c 2
 
 # create a pre-allocated vdi
diff --git a/tests/013 b/tests/013
index 9a1a21b..27c4bac 100755
--- a/tests/013
+++ b/tests/013
@@ -19,7 +19,7 @@ for i in 0 1 2; do
     _start_sheep $i
 done
 
-sleep 1
+_wait_for_sheep 3
 
 $COLLIE cluster format -c 1
 
diff --git a/tests/015 b/tests/015
index 71b0b0c..b6cc1a9 100755
--- a/tests/015
+++ b/tests/015
@@ -19,7 +19,7 @@ for i in 0 2; do
     _start_sheep $i
 done
 
-sleep 1
+_wait_for_sheep 2
 
 $COLLIE cluster format -c 2
 $COLLIE vdi create test 539545600
diff --git a/tests/016 b/tests/016
index ddf9c6b..ae9608b 100755
--- a/tests/016
+++ b/tests/016
@@ -19,7 +19,7 @@ for i in 0 1 2; do
     _start_sheep $i "-s 4096"
 done
 
-sleep 1;
+_wait_for_sheep 3
 
 $COLLIE cluster format -c 3
 $COLLIE vdi create base 100M -P
diff --git a/tests/017 b/tests/017
index 7cb7775..2858e22 100755
--- a/tests/017
+++ b/tests/017
@@ -19,7 +19,7 @@ for i in 0 1 2; do
     _start_sheep $i
 done
 
-sleep 1
+_wait_for_sheep 3
 
 $COLLIE cluster format -c 1
 
-- 
1.7.10.2




More information about the sheepdog mailing list