[sheepdog] [PATCH v1 3/3] test: add test case for append-operation in http service

Robin Dong robin.k.dong at gmail.com
Thu Mar 13 11:45:36 CET 2014


From: Robin Dong <sanbai at taobao.com>

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

diff --git a/tests/functional/090 b/tests/functional/090
new file mode 100755
index 0000000..bbe3205
--- /dev/null
+++ b/tests/functional/090
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Test 'append operation' in http service
+
+. ./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
+curl -s -X PUT http://localhost/v1/sd/dog
+
+# create large files
+rm -rf $STORE/data_merge
+for i in `seq 3 7`; do
+    _random | dd iflag=fullblock of=$STORE/data$i bs=1037475 count=$i &> /dev/null
+    cat $STORE/data$i >> $STORE/data_merge
+done
+
+cat $STORE/data_merge | md5sum > $STORE/ck1
+
+# upload the files to one object with append operation
+for i in `seq 3 7`; do
+       port=8$(($i % 6))
+       cat $STORE/data$i | curl -s -T - -X PUT http://localhost:$port/v1/sd/sheep/upload_merge -H 'FLAG: append'
+done
+curl -s -X PUT http://localhost/v1/sd/sheep/upload_merge -H 'FLAG: eof'
+
+# download the object
+curl -s -X GET http://localhost/v1/sd/sheep/upload_merge | md5sum > $STORE/ck2
+
+diff -u $STORE/ck1 $STORE/ck2
+
+# create small files
+rm -rf $STORE/data_merge_small
+for i in `seq 7 13`; do
+    _random | dd iflag=fullblock of=$STORE/data$i bs=137475 count=$i &> /dev/null
+    cat $STORE/data$i >> $STORE/data_merge_small
+done
+
+cat $STORE/data_merge_small | md5sum > $STORE/ck3
+
+# upload the files to one object with append operation
+for i in `seq 7 13`; do
+       port=8$(($i % 6))
+       cat $STORE/data$i | curl -s -T - -X PUT http://localhost:$port/v1/sd/sheep/upload_merge_small -H 'FLAG: append'
+done
+curl -s -X PUT http://localhost/v1/sd/sheep/upload_merge_small -H 'FLAG: eof'
+
+# download the object
+curl -s -X GET http://localhost/v1/sd/sheep/upload_merge_small | md5sum > $STORE/ck4
+
+diff -u $STORE/ck3 $STORE/ck4
+
+_vdi_list
diff --git a/tests/functional/090.out b/tests/functional/090.out
new file mode 100644
index 0000000..1e7f3af
--- /dev/null
+++ b/tests/functional/090.out
@@ -0,0 +1,8 @@
+QA output created by 090
+using backend plain store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+  sd/dog       0   16 PB  0.0 MB  0.0 MB DATE   5a5cbf    4:2              
+  sd           0   16 PB  8.0 MB  0.0 MB DATE   7927f2    4:2              
+  sd/sheep     0   16 PB  8.0 MB  0.0 MB DATE   8ad11e    4:2              
+  sd/dog/allocator     0   16 PB  4.0 MB  0.0 MB DATE   936d95    4:2              
+  sd/sheep/allocator     0   16 PB   64 MB  0.0 MB DATE   fd57fc    4:2              
diff --git a/tests/functional/group b/tests/functional/group
index 12879a6..7b880ce 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -104,3 +104,4 @@
 087 auto quick vdi md
 089 auto quick sheepfs
 088 auto quick cluster
+090 auto quick vdi md
-- 
1.7.12.4




More information about the sheepdog mailing list