1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#!/bin/bash
# Test http service with multiple servers
. ./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
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 | sort
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
|