[sheepdog] [PATCH v7 10/10] sheep: add functional test case for hyper volume

Robin Dong robin.k.dong at gmail.com
Sat Nov 16 15:57:39 CET 2013


Add test case for writing, reading and recovery of hyper volume.

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 tests/functional/077     |   55 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/077.out |   11 +++++++++
 tests/functional/group   |    1 +
 3 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100755 tests/functional/077
 create mode 100644 tests/functional/077.out

diff --git a/tests/functional/077 b/tests/functional/077
new file mode 100755
index 0000000..18d87a9
--- /dev/null
+++ b/tests/functional/077
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Test sheep write/read/recovery logic for hyper volume
+
+. ./common
+
+for i in `seq 0 2`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 16P -b
+_vdi_list
+
+# write many 2MB data from different offset of vdi
+for i in `seq 0 15`; do
+	_random | head -c 2M > $STORE/b$i
+	cat $STORE/b$i | md5sum > $STORE/cs$i
+	dd if=$STORE/b$i 2>/dev/null | $DOG vdi write test ${i}P 2M
+done
+
+# read these data out and check
+for i in `seq 0 15`; do
+	$DOG vdi read test ${i}P 2M > $STORE/c$i
+	cat $STORE/c$i | md5sum > $STORE/csum$i
+	diff -u -a $STORE/cs$i $STORE/csum$i
+done
+
+_vdi_list
+
+_cleanup
+
+# test sheep recovery logic for hyper volume (B-tree)
+for i in `seq 0 2`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 16P -b
+_vdi_list
+_random | $DOG vdi write test 15P 2M
+$DOG vdi read test 15P 2M | md5sum > $STORE/csum1
+
+_kill_sheep 2;
+$DOG vdi read test 15P 2M | md5sum > $STORE/csum2
+
+diff -u $STORE/csum1 $STORE/csum2
+
+_vdi_list
diff --git a/tests/functional/077.out b/tests/functional/077.out
new file mode 100644
index 0000000..36309be
--- /dev/null
+++ b/tests/functional/077.out
@@ -0,0 +1,11 @@
+QA output created by 077
+using backend plain store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         0   16 PB  0.0 MB  0.0 MB DATE   7c2b25     3              
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         0   16 PB   64 MB  0.0 MB DATE   7c2b25     3              
+using backend plain store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         0   16 PB  0.0 MB  0.0 MB DATE   7c2b25     3              
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         0   16 PB  4.0 MB  0.0 MB DATE   7c2b25     3              
diff --git a/tests/functional/group b/tests/functional/group
index 8d15ffe..a44ae6a 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -91,3 +91,4 @@
 074 auto quick clster md
 075 auto quick vdi md
 076 auto quick vdi md
+077 auto quick vdi md
-- 
1.7.1




More information about the sheepdog mailing list