[sheepdog] [PATCH v1 3/3] test: add test case for cache of http interface in sheepfs

Robin Dong robin.k.dong at gmail.com
Thu Mar 6 08:47:21 CET 2014


From: Robin Dong <sanbai at taobao.com>

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 tests/functional/088     | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/088.out |  6 ++++
 tests/functional/group   |  1 +
 3 files changed, 89 insertions(+)
 create mode 100755 tests/functional/088
 create mode 100644 tests/functional/088.out

diff --git a/tests/functional/088 b/tests/functional/088
new file mode 100755
index 0000000..70ffb8e
--- /dev/null
+++ b/tests/functional/088
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# Test http interface of 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
+
+which nginx > /dev/null || _notrun "Require nginx but it's not running"
+pkill nginx > /dev/null
+nginx -c `pwd`/nginx.conf
+
+for i in `seq 0 5`; do
+	_start_sheep $i "-r swift,port=800$i"
+done
+
+_wait_for_sheep 6
+
+_cluster_format -c 4:2
+
+curl -s -X PUT http://localhost/v1/sd
+curl -s -X PUT http://localhost/v1/sd/sheep
+
+for i in 4 19 97 137; do
+    _random | dd iflag=fullblock of=$STORE/data$i bs=1M count=$i &> /dev/null
+    dd if=$STORE/data$i 2> /dev/null | md5sum > $STORE/data$i.1
+done
+
+# upload the objects
+for i in 4 19 97 137; do
+	curl -s -T $STORE/data$i -X PUT http://localhost/v1/sd/sheep/data$i &
+done
+wait
+
+# mount objects in sheepfs
+mkdir -p $STORE/sheepfs
+$SHEEPFS $STORE/sheepfs/
+
+echo "localhost:83" > $STORE/sheepfs/http/address
+
+# mount objects
+for i in 4 19 97 137; do
+	echo "/sd/sheep/data$i" > $STORE/sheepfs/http/object
+done
+
+# read objects with 'cat'
+for i in 4 19 97 137; do
+	cat $STORE/sheepfs/http/sd/sheep/data$i | md5sum > $STORE/data$i.2 &
+done
+wait
+
+# read objects with 'dd'
+for i in 4 19 97 137; do
+	dd if=$STORE/sheepfs/http/sd/sheep/data$i bs=1345679 2> /dev/null | md5sum > $STORE/data$i.3 &
+done
+wait
+
+for i in 4 19 97 137; do
+	diff -u $STORE/data$i.1 $STORE/data$i.2
+	diff -u $STORE/data$i.1 $STORE/data$i.3
+done
+
+# read same objects with many processes
+for i in `seq 1 4`; do
+	dd if=$STORE/sheepfs/http/sd/sheep/data137 bs=134567 2> /dev/null | md5sum > $STORE/data$i.4 &
+done
+wait
+
+for i in `seq 1 4`; do
+	diff -u $STORE/data137.1 $STORE/data$i.4
+done
+
+_vdi_list
+
+status=0
diff --git a/tests/functional/088.out b/tests/functional/088.out
new file mode 100644
index 0000000..d6c2fcb
--- /dev/null
+++ b/tests/functional/088.out
@@ -0,0 +1,6 @@
+QA output created by 088
+using backend plain store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  sd           0   16 PB  4.0 MB  0.0 MB DATE   7927f2    4:2              
+  sd/sheep     0   16 PB   16 MB  0.0 MB DATE   8ad11e    4:2              
+  sd/sheep/allocator     0   16 PB  268 MB  0.0 MB DATE   fd57fc    4:2              
diff --git a/tests/functional/group b/tests/functional/group
index 0c9b71a..13866b5 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -102,3 +102,4 @@
 085 auto quick vdi md
 086 auto quick vdi md
 087 auto quick vdi md
+088 auto quick sheepfs
-- 
1.7.12.4




More information about the sheepdog mailing list