[sheepdog] [PATCH] tests/func: add sheepfs test

Liu Yuan namei.unix at gmail.com
Thu Aug 15 15:06:25 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 tests/functional/073           |   43 ++++++++++++++++++++++++++++++++++++++++
 tests/functional/073.out       |   11 ++++++++++
 tests/functional/common.config |    1 +
 tests/functional/group         |    4 +++-
 4 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100755 tests/functional/073
 create mode 100644 tests/functional/073.out

diff --git a/tests/functional/073 b/tests/functional/073
new file mode 100755
index 0000000..d8e870c
--- /dev/null
+++ b/tests/functional/073
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Test sheepfs
+
+. ./common
+
+trap "_uninit; exit \$status" 0 1 2 3 15
+_uninit()
+{
+	umount $STORE/sheepfs > /dev/null 2>&1
+	rm -rf $STORE/sheepfs > /dev/null 2>&1
+}
+
+_need_to_be_root
+
+# We can't pass PATH=$PATH:../../dog to sheepfs to expect it find dog
+# because fuse main loop can't inherit $PATH passed to sheepfs
+command -v dog > /dev/null 2>&1 || _notrun "Require dog but it's not installed"
+
+if [ ! -f $SHEEPFS ]; then
+    _notrun "no sheepfs binary found"
+fi
+
+for i in 0 1 2; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 4M
+
+mkdir $STORE/sheepfs
+$SHEEPFS $STORE/sheepfs
+
+cat $STORE/sheepfs/cluster/info | _filter_cluster_info
+cat $STORE/sheepfs/vdi/list | _filter_short_date
+echo test > $STORE/sheepfs/vdi/mount
+echo hello > $STORE/sheepfs/volume/test
+head -c 6 $STORE/sheepfs/volume/test
+
+status=0
diff --git a/tests/functional/073.out b/tests/functional/073.out
new file mode 100644
index 0000000..a46191a
--- /dev/null
+++ b/tests/functional/073.out
@@ -0,0 +1,11 @@
+QA output created by 073
+using backend plain store
+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]
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  test         0  4.0 MB  0.0 MB  0.0 MB DATE   7c2b25     3              
+hello
diff --git a/tests/functional/common.config b/tests/functional/common.config
index a946f2e..3a2230c 100644
--- a/tests/functional/common.config
+++ b/tests/functional/common.config
@@ -84,6 +84,7 @@ export VALGRIND_OPTIONS=${VALGRIND_OPTIONS:-"-q"}
 export MD=${MD:-false}
 export QEMU_IO=${QEMU_IO_PROG:-qemu-io}
 export QEMU_IMG=${QEMU_IMG_PROG:-qemu-img}
+export SHEEPFS=${SHEEPFS:-../../sheepfs/sheepfs}
 
 # make sure this script returns success
 /bin/true
diff --git a/tests/functional/group b/tests/functional/group
index 1749e13..15a60af 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -11,8 +11,9 @@
 # cluster:	cluster drivers tests: join/leave/etc
 # store:	basic data integrity
 # vdi:		qemu I/O, snapshots, volume creation and deletion
-# dog:	check dog commands
+# dog:		check dog commands
 # md:		multi-disk tests
+# sheepfs	check sheepfs
 #
 001 auto quick cluster md
 002 auto quick cluster md
@@ -86,3 +87,4 @@
 070 auto quick cluster md
 071 auto quick store md
 072 auto quick store
+073 auto quick sheepfs
-- 
1.7.9.5




More information about the sheepdog mailing list