2015-03-09 17:33:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o xtrace
|
|
|
|
set -o errexit
|
2010-11-13 23:59:23 +00:00
|
|
|
|
|
|
|
# Require root
|
|
|
|
REQUIRE_ROOT=require-root.sh
|
2015-01-12 22:46:24 +00:00
|
|
|
#source $REQUIRE_ROOT
|
2015-02-24 13:17:59 +00:00
|
|
|
source integration-test-common.sh
|
|
|
|
|
2015-03-09 17:33:47 +00:00
|
|
|
function retry {
|
|
|
|
set +o errexit
|
|
|
|
N=$1; shift;
|
|
|
|
status=0
|
|
|
|
for i in $(seq $N); do
|
|
|
|
$@
|
|
|
|
status=$?
|
|
|
|
if [ $status == 0 ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $status != 0 ]; then
|
|
|
|
echo "timeout waiting for $@"
|
|
|
|
fi
|
|
|
|
set -o errexit
|
|
|
|
return $status
|
|
|
|
}
|
|
|
|
|
|
|
|
function exit_handler {
|
|
|
|
kill $S3PROXY_PID
|
|
|
|
retry 30 fusermount -u $TEST_BUCKET_MOUNT_POINT_1
|
|
|
|
}
|
|
|
|
trap exit_handler EXIT
|
|
|
|
|
|
|
|
stdbuf -oL -eL java -jar "$S3PROXY_BINARY" --properties s3proxy.conf | stdbuf -oL -eL sed -u "s/^/s3proxy: /" &
|
2015-02-24 13:17:59 +00:00
|
|
|
|
|
|
|
# wait for S3Proxy to start
|
|
|
|
for i in $(seq 30);
|
|
|
|
do
|
|
|
|
if exec 3<>"/dev/tcp/localhost/8080";
|
|
|
|
then
|
|
|
|
exec 3<&- # Close for read
|
|
|
|
exec 3>&- # Close for write
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
2010-11-13 23:59:23 +00:00
|
|
|
|
2015-03-09 17:33:47 +00:00
|
|
|
S3PROXY_PID=$(netstat -lpnt | grep :8080 | awk '{ print $7 }' | sed -u 's|/java||')
|
|
|
|
|
2010-11-13 23:59:23 +00:00
|
|
|
# Mount the bucket
|
|
|
|
if [ ! -d $TEST_BUCKET_MOUNT_POINT_1 ]
|
|
|
|
then
|
|
|
|
mkdir -p $TEST_BUCKET_MOUNT_POINT_1
|
|
|
|
fi
|
2015-03-09 17:33:47 +00:00
|
|
|
stdbuf -oL -eL $S3FS $TEST_BUCKET_1 $TEST_BUCKET_MOUNT_POINT_1 \
|
2015-02-24 13:17:59 +00:00
|
|
|
-o createbucket \
|
2015-08-17 05:32:40 +00:00
|
|
|
-o enable_content_md5 \
|
2015-02-24 13:17:59 +00:00
|
|
|
-o passwd_file=$S3FS_CREDENTIALS_FILE \
|
|
|
|
-o sigv2 \
|
2015-07-27 22:47:08 +00:00
|
|
|
-o singlepart_copy_limit=$((10 * 1024)) \
|
2015-02-24 13:17:59 +00:00
|
|
|
-o url=http://127.0.0.1:8080 \
|
2015-03-09 17:33:47 +00:00
|
|
|
-o use_path_request_style -f -o f2 -d -d |& stdbuf -oL -eL sed -u "s/^/s3fs: /" &
|
2010-11-13 23:59:23 +00:00
|
|
|
|
2015-03-09 17:33:47 +00:00
|
|
|
retry 30 grep $TEST_BUCKET_MOUNT_POINT_1 /proc/mounts || exit 1
|
2010-12-20 05:26:27 +00:00
|
|
|
|
2015-03-09 17:33:47 +00:00
|
|
|
./integration-test-main.sh $TEST_BUCKET_MOUNT_POINT_1
|
2015-02-24 13:17:59 +00:00
|
|
|
|
2010-12-20 05:26:27 +00:00
|
|
|
echo "All tests complete."
|