mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-05 04:17:52 +00:00
Merge pull request #263 from RobbKistler/aws
Allow integration testing against Amazon S3
This commit is contained in:
commit
53bc960224
@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
set -x
|
||||||
S3FS=../src/s3fs
|
S3FS=../src/s3fs
|
||||||
|
|
||||||
S3FS_CREDENTIALS_FILE="passwd-s3fs"
|
: ${S3FS_CREDENTIALS_FILE:="passwd-s3fs"}
|
||||||
|
|
||||||
TEST_BUCKET_1="s3fs-integration-test"
|
: ${TEST_BUCKET_1:="s3fs-integration-test"}
|
||||||
TEST_BUCKET_MOUNT_POINT_1=${TEST_BUCKET_1}
|
TEST_BUCKET_MOUNT_POINT_1=${TEST_BUCKET_1}
|
||||||
|
|
||||||
if [ ! -f "$S3FS_CREDENTIALS_FILE" ]
|
if [ ! -f "$S3FS_CREDENTIALS_FILE" ]
|
||||||
@ -15,8 +15,8 @@ fi
|
|||||||
chmod 600 "$S3FS_CREDENTIALS_FILE"
|
chmod 600 "$S3FS_CREDENTIALS_FILE"
|
||||||
|
|
||||||
S3PROXY_VERSION="1.4.0"
|
S3PROXY_VERSION="1.4.0"
|
||||||
S3PROXY_BINARY="s3proxy-${S3PROXY_VERSION}"
|
S3PROXY_BINARY=${S3PROXY_BINARY-"s3proxy-${S3PROXY_VERSION}"}
|
||||||
if [ ! -e "${S3PROXY_BINARY}" ]; then
|
if [ -n "${S3PROXY_BINARY}" ] && [ ! -e "${S3PROXY_BINARY}" ]; then
|
||||||
wget "https://github.com/andrewgaul/s3proxy/releases/download/s3proxy-${S3PROXY_VERSION}/s3proxy" \
|
wget "https://github.com/andrewgaul/s3proxy/releases/download/s3proxy-${S3PROXY_VERSION}/s3proxy" \
|
||||||
--quiet -O "${S3PROXY_BINARY}"
|
--quiet -O "${S3PROXY_BINARY}"
|
||||||
chmod +x "${S3PROXY_BINARY}"
|
chmod +x "${S3PROXY_BINARY}"
|
||||||
|
@ -1,8 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# By default tests run against a local s3proxy instance. To run against
|
||||||
|
# Amazon S3, specify the following variables:
|
||||||
|
#
|
||||||
|
# S3FS_CREDENTIALS_FILE=keyfile s3fs format key file
|
||||||
|
# TEST_BUCKET_1=bucket Name of bucket to use
|
||||||
|
# S3PROXY_BINARY="" Leave empty
|
||||||
|
# S3_URL="http://s3.amazonaws.com" Specify Amazon server
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# S3FS_CREDENTIALS_FILE=keyfile TEST_BUCKET_1=bucket S3PROXY_BINARY="" S3_URL="http://s3.amazonaws.com" ./small-integration-test.sh
|
||||||
|
#
|
||||||
|
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
: ${S3_URL:="http://127.0.0.1:8080"}
|
||||||
|
|
||||||
# Require root
|
# Require root
|
||||||
REQUIRE_ROOT=require-root.sh
|
REQUIRE_ROOT=require-root.sh
|
||||||
#source $REQUIRE_ROOT
|
#source $REQUIRE_ROOT
|
||||||
@ -29,16 +45,21 @@ function retry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exit_handler {
|
function exit_handler {
|
||||||
|
if [ -n "${S3PROXY_PID}" ]
|
||||||
|
then
|
||||||
kill $S3PROXY_PID
|
kill $S3PROXY_PID
|
||||||
|
fi
|
||||||
retry 30 fusermount -u $TEST_BUCKET_MOUNT_POINT_1
|
retry 30 fusermount -u $TEST_BUCKET_MOUNT_POINT_1
|
||||||
}
|
}
|
||||||
trap exit_handler EXIT
|
trap exit_handler EXIT
|
||||||
|
|
||||||
stdbuf -oL -eL java -jar "$S3PROXY_BINARY" --properties s3proxy.conf | stdbuf -oL -eL sed -u "s/^/s3proxy: /" &
|
if [ -n "${S3PROXY_BINARY}" ]
|
||||||
|
then
|
||||||
|
stdbuf -oL -eL java -jar "$S3PROXY_BINARY" --properties s3proxy.conf | stdbuf -oL -eL sed -u "s/^/s3proxy: /" &
|
||||||
|
|
||||||
# wait for S3Proxy to start
|
# wait for S3Proxy to start
|
||||||
for i in $(seq 30);
|
for i in $(seq 30);
|
||||||
do
|
do
|
||||||
if exec 3<>"/dev/tcp/localhost/8080";
|
if exec 3<>"/dev/tcp/localhost/8080";
|
||||||
then
|
then
|
||||||
exec 3<&- # Close for read
|
exec 3<&- # Close for read
|
||||||
@ -46,9 +67,10 @@ do
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
S3PROXY_PID=$(netstat -lpnt | grep :8080 | awk '{ print $7 }' | sed -u 's|/java||')
|
S3PROXY_PID=$(netstat -lpnt | grep :8080 | awk '{ print $7 }' | sed -u 's|/java||')
|
||||||
|
fi
|
||||||
|
|
||||||
# Mount the bucket
|
# Mount the bucket
|
||||||
if [ ! -d $TEST_BUCKET_MOUNT_POINT_1 ]
|
if [ ! -d $TEST_BUCKET_MOUNT_POINT_1 ]
|
||||||
@ -61,7 +83,7 @@ stdbuf -oL -eL $S3FS $TEST_BUCKET_1 $TEST_BUCKET_MOUNT_POINT_1 \
|
|||||||
-o passwd_file=$S3FS_CREDENTIALS_FILE \
|
-o passwd_file=$S3FS_CREDENTIALS_FILE \
|
||||||
-o sigv2 \
|
-o sigv2 \
|
||||||
-o singlepart_copy_limit=$((10 * 1024)) \
|
-o singlepart_copy_limit=$((10 * 1024)) \
|
||||||
-o url=http://127.0.0.1:8080 \
|
-o url=${S3_URL} \
|
||||||
-o use_path_request_style -f -o f2 -d -d |& stdbuf -oL -eL sed -u "s/^/s3fs: /" &
|
-o use_path_request_style -f -o f2 -d -d |& stdbuf -oL -eL sed -u "s/^/s3fs: /" &
|
||||||
|
|
||||||
retry 30 grep $TEST_BUCKET_MOUNT_POINT_1 /proc/mounts || exit 1
|
retry 30 grep $TEST_BUCKET_MOUNT_POINT_1 /proc/mounts || exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user