[sheepdog] [PATCH 2/2] tests: add a test for journal replay

Liu Yuan namei.unix at gmail.com
Thu Nov 15 07:08:14 CET 2012


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


Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/047     |   44 ++++++++++++++++++++++++++++++++++++++++++++
 tests/047.out |    5 +++++
 tests/group   |    1 +
 3 files changed, 50 insertions(+)
 create mode 100755 tests/047
 create mode 100644 tests/047.out

diff --git a/tests/047 b/tests/047
new file mode 100755
index 0000000..34b64f3
--- /dev/null
+++ b/tests/047
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Test journal file replay
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1        # failure is the default!
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_cleanup
+
+_start_sheep 0 "-j size=64"
+
+_wait_for_sheep 1
+
+$COLLIE cluster format -c 1
+sleep 1
+
+$COLLIE vdi create test 4G
+
+# write something to vdi 'test'
+echo "hello" | $COLLIE vdi write test 0 512
+echo "sheepdog" | $COLLIE vdi write test 4M 512
+# corrupt the vdi...
+_kill_sheep 0
+rm $STORE/0/obj/807c2b2500000000
+rm $STORE/0/obj/007c2b25*
+# do the journal replay
+_start_sheep 0 "-j size=64"
+_wait_for_sheep 1
+
+sleep 3
+
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi read test 0 512 | tr -d [:cntrl:]
+echo -n ' '
+$COLLIE vdi read test 4M 512 | tr -d [:cntrl:]
+echo ''
diff --git a/tests/047.out b/tests/047.out
new file mode 100644
index 0000000..4bd7363
--- /dev/null
+++ b/tests/047.out
@@ -0,0 +1,5 @@
+QA output created by 047
+using backend farm store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         1  4.0 GB  8.0 MB  0.0 MB DATE   7c2b25     1              
+hello sheepdog
diff --git a/tests/group b/tests/group
index 695431f..aaddfeb 100644
--- a/tests/group
+++ b/tests/group
@@ -58,3 +58,4 @@
 044 auto quick vdi
 045 auto quick store
 046 auto quick vdi
+047 auto quick vdi
-- 
1.7.9.5




More information about the sheepdog mailing list