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
|
#!/bin/bash
# Test http interface of sheepfs
. ./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
for i in 3 7 19 37 57 97; 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
# upload the objects
for i in 3 7 19 37 57 97; do
curl -s -T $STORE/data$i -X PUT http://localhost/v1/sd/sheep/data$i &
done
wait
# mount sheepfs and check the objects
mkdir $STORE/sheepfs 2> /dev/null
$SHEEPFS $STORE/sheepfs
echo "localhost" > $STORE/sheepfs/http/address
for i in 3 7 19 37 57 97; do
echo "/sd/sheep/data$i" > $STORE/sheepfs/http/object
done
wait
for i in 3 7 19 37 57 97; do
diff -u $STORE/data$i $STORE/sheepfs/http/sd/sheep/data$i
done
# remove local entries
rm -rf $STORE/sheepfs/http/sd/
find $STORE/sheepfs/http/ | sort
umount $STORE/sheepfs
|