[sheepdog] [PATCH v2 3/3] test: add test case for append-operation in http service
Robin Dong
robin.k.dong at gmail.com
Wed Mar 19 05:44:25 CET 2014
From: Robin Dong <sanbai at taobao.com>
Signed-off-by: Robin Dong <sanbai at taobao.com>
---
tests/functional/090 | 89 ++++++++++++++++++++++++++++++++++++++++++++++++
tests/functional/090.out | 20 +++++++++++
tests/functional/group | 1 +
3 files changed, 110 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..ab4aff4
--- /dev/null
+++ b/tests/functional/090
@@ -0,0 +1,89 @@
+#!/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
+_vdi_list
+
+# 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
+
+# create aligned files
+rm -rf $STORE/data_merge_aligned
+for i in `seq 3 5`; do
+ _random | dd iflag=fullblock of=$STORE/data$i bs=4M count=$i &> /dev/null
+ cat $STORE/data$i >> $STORE/data_merge_aligned
+done
+
+cat $STORE/data_merge_aligned | md5sum > $STORE/ck5
+
+# upload the files to one object with append operation
+for i in `seq 3 5`; do
+ port=8$(($i % 6))
+ cat $STORE/data$i | curl -s -T - -X PUT http://localhost:$port/v1/sd/sheep/upload_merge_aligned -H 'FLAG: append'
+done
+curl -s -X PUT http://localhost/v1/sd/sheep/upload_merge_aligned -H 'FLAG: eof'
+
+# download the object
+curl -s -X GET http://localhost/v1/sd/sheep/upload_merge_aligned | md5sum > $STORE/ck6
+
+diff -u $STORE/ck5 $STORE/ck6
+_vdi_list
diff --git a/tests/functional/090.out b/tests/functional/090.out
new file mode 100644
index 0000000..5ad3422
--- /dev/null
+++ b/tests/functional/090.out
@@ -0,0 +1,20 @@
+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 4.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 32 MB 0.0 MB DATE fd57fc 4:2
+ 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 44 MB 0.0 MB DATE fd57fc 4:2
+ 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 12 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 92 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