[sheepdog] [PATCH stable-0.8 2/3] tests/func: add tests for object misplacement

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Thu Mar 6 08:58:45 CET 2014


From: Liu Yuan <namei.unix at gmail.com>

Current master can't pass it and following patch will solve it

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/functional/085       |   42 ++++++++++++++++++++++++++++++++++++++++++
 tests/functional/085.out   |   10 ++++++++++
 tests/functional/common.rc |    3 ++-
 tests/functional/group     |    1 +
 4 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100755 tests/functional/085
 create mode 100644 tests/functional/085.out

diff --git a/tests/functional/085 b/tests/functional/085
new file mode 100755
index 0000000..3927182
--- /dev/null
+++ b/tests/functional/085
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# Restart sheep with less disks in MD setup
+
+. ./common
+
+MD=true
+
+for i in `seq 0 5`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 6
+
+_cluster_format -c 6
+
+_vdi_create test 100M
+# create 25 objects
+for i in `seq 0 24`; do
+    echo $i | $DOG vdi write test $((i * 4 * 1024 * 1024)) 512
+done
+
+$DOG vdi read test | md5sum
+
+$DOG cluster shutdown
+_wait_for_sheep_stop
+
+for i in `seq 0 4`; do
+    _start_sheep $i
+done
+
+# start sheep with different number of disks than that before shutdown
+MD_STORE=",$STORE/5/d0,$STORE/5/d1,$STORE/5/d2,$STORE/5/d3"
+_start_sheep 5
+
+_wait_for_sheep 6
+
+for i in `seq 0 24`; do
+    echo $(($i+1)) | $DOG vdi write test $((i * 4 * 1024 * 1024)) 512
+done
+$DOG vdi read test | md5sum
+$DOG cluster info | _filter_cluster_info
diff --git a/tests/functional/085.out b/tests/functional/085.out
new file mode 100644
index 0000000..78b476a
--- /dev/null
+++ b/tests/functional/085.out
@@ -0,0 +1,10 @@
+QA output created by 085
+using backend plain store
+9c7766570b3be3aff2724f587c2f4107  -
+a6c5d562057d0b8e7c90df17e5ea9450  -
+Cluster status: running, auto-recovery enabled
+
+Cluster created at DATE
+
+Epoch Time           Version
+DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002, 127.0.0.1:7003, 127.0.0.1:7004, 127.0.0.1:7005]
diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index 9c17248..5388e48 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -300,7 +300,7 @@ _start_sheep()
         _die "sheep $1 is still running"
     fi
 
-    if $MD; then
+    if $MD && [ -z "$MD_STORE" ]; then
 	MD_STORE=",$STORE/$1/d0,$STORE/$1/d1,$STORE/$1/d2"
     fi
 
@@ -309,6 +309,7 @@ _start_sheep()
     if [ $? != 0 ]; then
         _die "cannot start sheep $1"
     fi
+    unset MD_STORE
 }
 
 _kill_all_dogs()
diff --git a/tests/functional/group b/tests/functional/group
index 49e08a5..746d2d2 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -99,3 +99,4 @@
 082 auto quick vdi md
 083 auto quick vdi
 084 auto quick sheepfs
+085 auto quick vdi md
-- 
1.7.10.4




More information about the sheepdog mailing list