[sheepdog] [PATCH] tests/functional: replace sleep with _wait_for_sheep

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Jul 12 22:46:56 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

This replaces sleep with _wait_for_sheep and fixes a false alarm of
some tests.

This also removes a iteration of the test internal 007.  We can do the
same thing by running the test 007 several times.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/functional/007     |   26 ++++++++------------------
 tests/functional/007.out |   19 ++++++++++++++++++-
 tests/functional/052     |    2 +-
 tests/functional/069     |   11 +++++------
 4 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/tests/functional/007 b/tests/functional/007
index 1cc7763..af0338d 100755
--- a/tests/functional/007
+++ b/tests/functional/007
@@ -28,21 +28,11 @@ _start_sheep 0
 _wait_for_sheep 1
 _cluster_format -p 7000 -c 1
 
-for i in `seq 0 5`; do
-    _start_sheep 1  # should fail
-    sleep 1
-    _start_sheep 2  # should succeed
-    _wait_for_sheep 2
-
-    if [ "`$COLLIE node list -p 7002 -r | wc -l`" -ne 2 ]; then
-	echo "test failed"
-	$COLLIE cluster info -p 7000 | _filter_cluster_info
-	$COLLIE cluster info -p 7002 | _filter_cluster_info
-	exit 1
-    fi
-
-    _kill_sheep 2
-    _wait_for_sheep 1
-done
-
-echo "success"
+_start_sheep 1  # should fail
+_wait_for_sheep_stop 1
+_wait_for_sheep 1
+_start_sheep 2  # should succeed
+_wait_for_sheep 2
+
+$COLLIE cluster info -p 7000 | _filter_cluster_info
+$COLLIE cluster info -p 7002 | _filter_cluster_info
diff --git a/tests/functional/007.out b/tests/functional/007.out
index 2eb8515..8ff2a20 100644
--- a/tests/functional/007.out
+++ b/tests/functional/007.out
@@ -1,4 +1,21 @@
 QA output created by 007
 using backend plain store
 using backend plain store
-success
+Cluster status: running, auto-recovery enabled
+
+Cluster created at DATE
+
+Epoch Time           Version
+DATE      4 [127.0.0.1:7000, 127.0.0.1:7002]
+DATE      3 [127.0.0.1:7000]
+DATE      2 [127.0.0.1:7000, 127.0.0.1:7001]
+DATE      1 [127.0.0.1:7000]
+Cluster status: running, auto-recovery enabled
+
+Cluster created at DATE
+
+Epoch Time           Version
+DATE      4 [127.0.0.1:7000, 127.0.0.1:7002]
+DATE      3 [127.0.0.1:7000]
+DATE      2 [127.0.0.1:7000, 127.0.0.1:7001]
+DATE      1 [127.0.0.1:7000]
diff --git a/tests/functional/052 b/tests/functional/052
index ae0834a..21653fc 100755
--- a/tests/functional/052
+++ b/tests/functional/052
@@ -38,7 +38,7 @@ done
 echo yes | $COLLIE cluster recover force
 echo ""
 
-sleep 1
+_wait_for_sheep_recovery 0
 $COLLIE vdi check test | sort
 
 for i in 0 1 2 4; do
diff --git a/tests/functional/069 b/tests/functional/069
index d453aca..aad6ca9 100755
--- a/tests/functional/069
+++ b/tests/functional/069
@@ -48,13 +48,12 @@ $COLLIE cluster shutdown
 _wait_for_sheep_stop
 
 # sheep 2 should fail to join because it was formatted at the different time
-for i in 1 2 0; do
-    _start_sheep $i
-    sleep 1
-done
-
-# sheepdog should start with sheep 0 and sheep 1
+_start_sheep 0
+_wait_for_sheep 1
+_start_sheep 2
 _wait_for_sheep_stop 2
+_wait_for_sheep 1
+_start_sheep 1
 _wait_for_sheep 2
 
 for i in 0 1; do
-- 
1.7.9.5



More information about the sheepdog mailing list