[sheepdog] [PATCH v3 3/4] tests/func: add 081 to test http service

Liu Yuan namei.unix at gmail.com
Thu Dec 19 08:35:04 CET 2013


Current master can pass it with local driver, but zk driver can't.

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

diff --git a/tests/functional/081 b/tests/functional/081
new file mode 100755
index 0000000..92dd04f
--- /dev/null
+++ b/tests/functional/081
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Test http service with a single server
+
+. ./common
+
+_need_to_be_root
+
+pgrep 'nginx' > /dev/null || _notrun "Require nginx but it's not running"
+nginx -s stop
+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 POST http://localhost/v1/sd
+curl -s -X PUT http://localhost/v1/sd/sheep
+curl -s -X PUT http://localhost/v1/sd/dog
+
+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
+sheep_files=`find $SOURCE/sheep -name '*.c'`
+dog_files=`find $SOURCE/dog -name '*.c'`
+
+# upload the objects
+for file in $sheep_files; do
+	f=`basename $file`
+	cat $file | md5sum > $STORE/sheep.$f.1
+	cat $file | curl -s -T "-" -X PUT http://localhost/v1/sd/sheep/$f &
+done
+
+for file in $dog_files; do
+	f=`basename $file`
+	cat $file | md5sum > $STORE/dog.$f.1
+	cat $file | curl -s -T "-" -X PUT http://localhost/v1/sd/dog/$f &
+done
+
+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
+
+# list the container and objects
+curl -s -X GET http://localhost/v1/sd
+curl -s -X GET http://localhost/v1/sd/sheep | sort
+curl -s -X GET http://localhost/v1/sd/dog | sort
+
+# download the objects
+for file in $sheep_files; do
+	f=`basename $file`
+	curl -s -X GET http://localhost/v1/sd/sheep/$f | md5sum > $STORE/sheep.$f.2 &
+done
+for file in $dog_files; do
+	f=`basename $file`
+	curl -s -X GET http://localhost/v1/sd/dog/$f | md5sum > $STORE/dog.$f.2 &
+done
+for i in 4 19 97 137; do
+	curl -s -X GET http://localhost/v1/sd/sheep/data$i | md5sum > $STORE/data$i.2 &
+done
+wait
+
+# check the objects
+for file in $sheep_files; do
+	f=`basename $file`
+	diff -u $STORE/sheep.$f.1 $STORE/sheep.$f.2
+done
+for file in $dog_files; do
+	f=`basename $file`
+	diff -u $STORE/dog.$f.1 $STORE/dog.$f.2
+done
+for i in 4 19 97 137; do
+	diff -u $STORE/data$i.1 $STORE/data$i.2
+done
+
+_vdi_list
+
+#delete the objects
+for file in $sheep_files; do
+	f=`basename $file`
+	curl -s -X DELETE http://localhost/v1/sd/sheep/$f &
+done
+wait
+curl -s -X GET http://localhost/v1/sd/sheep | sort
+
+_vdi_list
+
+for i in 4 19 97 137; do
+	curl -s -X DELETE http://localhost/v1/sd/sheep/data$i &
+done
+wait
+
+curl -s -X DELETE http://localhost/v1/sd/dog
+
+curl -s -X GET http://localhost/v1/sd
+curl -s -X GET http://localhost/v1/sd/sheep
+
+_vdi_list
diff --git a/tests/functional/081.out b/tests/functional/081.out
new file mode 100644
index 0000000..95ab894
--- /dev/null
+++ b/tests/functional/081.out
@@ -0,0 +1,69 @@
+QA output created by 081
+using backend plain store
+sheep
+dog
+checker.c
+config.c
+corosync.c
+data137
+data19
+data4
+data97
+gateway.c
+graph.c
+group.c
+http.c
+journal.c
+kv.c
+local.c
+md.c
+migrate.c
+oalloc.c
+object_cache.c
+object_list_cache.c
+ops.c
+plain_store.c
+recovery.c
+request.c
+s3.c
+sheep.c
+shepherd.c
+store.c
+swift.c
+trace.c
+vdi.c
+zookeeper.c
+cluster.c
+common.c
+dog.c
+farm.c
+node.c
+object_tree.c
+sha1_file.c
+slice.c
+snap.c
+trace.c
+treeview.c
+trunk.c
+vdi.c
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  sd/dog       0   16 PB   52 MB  0.0 MB DATE   5a5cbf     6              
+  sd           0   16 PB  8.0 MB  0.0 MB DATE   7927f2     6              
+  sd/sheep     0   16 PB  124 MB  0.0 MB DATE   8ad11e     6              
+  sd/dog/allocator     0   16 PB  4.0 MB  0.0 MB DATE   936d95     6              
+  sd/sheep/allocator     0   16 PB  268 MB  0.0 MB DATE   fd57fc     6              
+data137
+data19
+data4
+data97
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  sd/dog       0   16 PB   52 MB  0.0 MB DATE   5a5cbf     6              
+  sd           0   16 PB  8.0 MB  0.0 MB DATE   7927f2     6              
+  sd/sheep     0   16 PB   16 MB  0.0 MB DATE   8ad11e     6              
+  sd/dog/allocator     0   16 PB  4.0 MB  0.0 MB DATE   936d95     6              
+  sd/sheep/allocator     0   16 PB  268 MB  0.0 MB DATE   fd57fc     6              
+sheep
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  sd           0   16 PB  4.0 MB  0.0 MB DATE   7927f2     6              
+  sd/sheep     0   16 PB  0.0 MB  0.0 MB DATE   8ad11e     6              
+  sd/sheep/allocator     0   16 PB  4.0 MB  0.0 MB DATE   fd57fc     6              
diff --git a/tests/functional/common.config b/tests/functional/common.config
index 482bdd9..dc07748 100644
--- a/tests/functional/common.config
+++ b/tests/functional/common.config
@@ -86,6 +86,7 @@ export EC=${EC:-false}
 export QEMU_IO=${QEMU_IO_PROG:-qemu-io}
 export QEMU_IMG=${QEMU_IMG_PROG:-qemu-img}
 export SHEEPFS=${SHEEPFS:-../../sheepfs/sheepfs}
+export SOURCE=${SOURCE:-../..}
 
 # make sure this script returns success
 /bin/true
diff --git a/tests/functional/group b/tests/functional/group
index e999b6f..1a3ce8c 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -95,3 +95,4 @@
 078 auto quick vdi md
 079 auto quick vdi md
 080 auto quick vdi md
+081 auto quick vdi md
-- 
1.7.9.5




More information about the sheepdog mailing list