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

Robin Dong robin.k.dong at gmail.com
Thu Jan 23 06:57:53 CET 2014


From: Robin Dong <sanbai at taobao.com>

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

diff --git a/tests/functional/084 b/tests/functional/084
new file mode 100755
index 0000000..1bc7724
--- /dev/null
+++ b/tests/functional/084
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Test http interface of sheepfs
+
+. ./common
+
+_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 3 7 19 37 57 97; 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 3 7 19 37 57 97; do
+	curl -s -T $STORE/data$i -X PUT http://localhost/v1/sd/sheep/data$i &
+done
+wait
+
+# mount sheepfs and check the objects
+mkdir $STORE/sheepfs
+$SHEEPFS $STORE/sheepfs
+
+echo "localhost" > $STORE/sheepfs/http/address
+
+for i in 3 7 19 37 57 97; do
+	echo "/sd/sheep/data$i" > $STORE/sheepfs/http/object
+done
+wait
+
+for i in 3 7 19 37 57 97; do
+	diff -u $STORE/data$i $STORE/sheepfs/http/sd/sheep/data$i
+done
+
+umount $STORE/sheepfs
diff --git a/tests/functional/084.out b/tests/functional/084.out
new file mode 100644
index 0000000..48147c1
--- /dev/null
+++ b/tests/functional/084.out
@@ -0,0 +1,2 @@
+QA output created by 084
+using backend plain store
diff --git a/tests/functional/group b/tests/functional/group
index 9b17e97..49e08a5 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -98,3 +98,4 @@
 081 auto quick vdi md
 082 auto quick vdi md
 083 auto quick vdi
+084 auto quick sheepfs
-- 
1.7.12.4




More information about the sheepdog mailing list