[sheepdog] [PATCH v3 4/4] tests/func: add 082 to test http services with multiple servers

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


Current local deiver can pass it but zk can't

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 tests/functional/082     |  112 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/082.out |   85 +++++++++++++++++++++++++++++++++++
 tests/functional/group   |    1 +
 3 files changed, 198 insertions(+)
 create mode 100755 tests/functional/082
 create mode 100644 tests/functional/082.out

diff --git a/tests/functional/082 b/tests/functional/082
new file mode 100755
index 0000000..011904b
--- /dev/null
+++ b/tests/functional/082
@@ -0,0 +1,112 @@
+#!/bin/bash
+
+# Test http service with multiple servers
+
+. ./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 `seq 1 12`; do
+    _random | dd iflag=fullblock of=$STORE/data$i bs=4M 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`
+       port=8$(($RANDOM % 6))
+       cat $file | md5sum > $STORE/sheep.$f.1
+       curl -s -T $file -X PUT http://localhost:$port/v1/sd/sheep/$f &
+done
+
+for file in $dog_files; do
+       f=`basename $file`
+       port=8$(($RANDOM % 6))
+       cat $file | md5sum > $STORE/dog.$f.1
+       curl -s -T $file -X PUT http://localhost:$port/v1/sd/dog/$f &
+done
+
+for i in `seq 1 12`; do
+       port=8$(($i % 6))
+       curl -s -T $STORE/data$i -X PUT http://localhost:$port/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`
+       port=8$(($RANDOM % 6))
+       curl -s -X GET http://localhost:$port/v1/sd/sheep/$f | md5sum > $STORE/sheep.$f.2 &
+done
+for file in $dog_files; do
+       f=`basename $file`
+       port=8$(($RANDOM % 6))
+       curl -s -X GET http://localhost:$port/v1/sd/dog/$f | md5sum > $STORE/dog.$f.2 &
+done
+for i in `seq 1 12`; do
+       port=8$(($i % 6))
+       curl -s -X GET http://localhost:$port/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 `seq 1 12`; 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`
+       port=8$(($RANDOM % 6))
+       curl -s -X DELETE http://localhost:$port/v1/sd/sheep/$f &
+done
+wait
+curl -s -X GET http://localhost/v1/sd/sheep | sort
+
+_vdi_list
+
+for i in `seq 1 12`; do
+       port=8$(($i % 6))
+       curl -s -X DELETE http://localhost:$port/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/082.out b/tests/functional/082.out
new file mode 100644
index 0000000..f1bbbfe
--- /dev/null
+++ b/tests/functional/082.out
@@ -0,0 +1,85 @@
+QA output created by 082
+using backend plain store
+sheep
+dog
+checker.c
+config.c
+corosync.c
+data1
+data10
+data11
+data12
+data2
+data3
+data4
+data5
+data6
+data7
+data8
+data9
+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  156 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  316 MB  0.0 MB DATE   fd57fc     6              
+data1
+data10
+data11
+data12
+data2
+data3
+data4
+data5
+data6
+data7
+data8
+data9
+  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   48 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  316 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/group b/tests/functional/group
index 1a3ce8c..4015610 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -96,3 +96,4 @@
 079 auto quick vdi md
 080 auto quick vdi md
 081 auto quick vdi md
+082 auto quick vdi md
-- 
1.7.9.5




More information about the sheepdog mailing list