Updates captainplanet test scripts to use /tmp/capt for test files (#517)
* creates tmp dir and cleans it up after script runs * updates captplanet test script to use tmpdir * updates tmpdir to use windows-compatible mktemp
This commit is contained in:
parent
94128d63a1
commit
28ee32f322
@ -13,30 +13,36 @@ kill -9 $CAPT_PID
|
||||
captplanet run &
|
||||
CAPT_PID=$!
|
||||
|
||||
#setup tmpdir for testfiles and cleanup
|
||||
TMP_DIR=$(mktemp -d -t tmp.XXXXXXXXXX)
|
||||
CMP_DIR=$(mktemp -d -t tmp.XXXXXXXXXX)
|
||||
mkdir -p $TMP_DIR
|
||||
mkdir -p $CMP_DIR
|
||||
|
||||
aws configure set aws_access_key_id insecure-dev-access-key
|
||||
aws configure set aws_secret_access_key insecure-dev-secret-key
|
||||
aws configure set default.region us-east-1
|
||||
|
||||
head -c 1024 </dev/urandom > ./small-upload-testfile # create 1mb file of random bytes (inline)
|
||||
head -c 5120 </dev/urandom > ./big-upload-testfile # create 5mb file of random bytes (remote)
|
||||
head -c 5 </dev/urandom > ./multipart-upload-testfile # create 5kb file of random bytes (remote)
|
||||
head -c 1024 </dev/urandom > $TMP_DIR/small-upload-testfile # create 1mb file of random bytes (inline)
|
||||
head -c 5120 </dev/urandom > $TMP_DIR/big-upload-testfile # create 5mb file of random bytes (remote)
|
||||
head -c 5 </dev/urandom > $TMP_DIR/multipart-upload-testfile # create 5kb file of random bytes (remote)
|
||||
|
||||
aws s3 --endpoint=http://localhost:7777/ mb s3://bucket
|
||||
|
||||
aws configure set default.s3.multipart_threshold 1TB
|
||||
aws s3 --endpoint=http://localhost:7777/ cp ./small-upload-testfile s3://bucket/small-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp ./big-upload-testfile s3://bucket/big-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp $TMP_DIR/small-upload-testfile s3://bucket/small-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp $TMP_DIR/big-upload-testfile s3://bucket/big-testfile
|
||||
|
||||
aws configure set default.s3.multipart_threshold 4KB
|
||||
aws s3 --endpoint=http://localhost:7777/ cp ./multipart-upload-testfile s3://bucket/multipart-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp $TMP_DIR/multipart-upload-testfile s3://bucket/multipart-testfile
|
||||
|
||||
aws s3 --endpoint=http://localhost:7777/ ls s3://bucket
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/small-testfile ./small-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/big-testfile ./big-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/multipart-testfile ./multipart-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/small-testfile $CMP_DIR/small-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/big-testfile $CMP_DIR/big-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/multipart-testfile $CMP_DIR/multipart-download-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ rb s3://bucket --force
|
||||
|
||||
if cmp ./small-upload-testfile ./small-download-testfile
|
||||
if cmp $TMP_DIR/small-upload-testfile $CMP_DIR/small-download-testfile
|
||||
then
|
||||
echo "Downloaded file matches uploaded file";
|
||||
else
|
||||
@ -45,7 +51,7 @@ else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if cmp ./big-upload-testfile ./big-download-testfile
|
||||
if cmp $TMP_DIR/big-upload-testfile $CMP_DIR/big-download-testfile
|
||||
then
|
||||
echo "Downloaded file matches uploaded file";
|
||||
else
|
||||
@ -54,7 +60,7 @@ else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if cmp ./multipart-upload-testfile ./multipart-download-testfile
|
||||
if cmp $TMP_DIR/multipart-upload-testfile $CMP_DIR/multipart-download-testfile
|
||||
then
|
||||
echo "Downloaded file matches uploaded file";
|
||||
else
|
||||
@ -70,11 +76,11 @@ captplanet run &
|
||||
CAPT_PID=$!
|
||||
|
||||
aws s3 --endpoint=http://localhost:7777/ mb s3://bucket
|
||||
aws s3 --endpoint=http://localhost:7777/ cp ./big-upload-testfile s3://bucket/big-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/big-testfile ./big-download-testfile-ipv6
|
||||
aws s3 --endpoint=http://localhost:7777/ cp $TMP_DIR/big-upload-testfile s3://bucket/big-testfile
|
||||
aws s3 --endpoint=http://localhost:7777/ cp s3://bucket/big-testfile $CMP_DIR/big-download-testfile-ipv6
|
||||
aws s3 --endpoint=http://localhost:7777/ rb s3://bucket --force
|
||||
|
||||
if cmp ./big-upload-testfile ./big-download-testfile-ipv6
|
||||
if cmp $TMP_DIR/big-upload-testfile $CMP_DIR/big-download-testfile-ipv6
|
||||
then
|
||||
echo "Downloaded ipv6 file matches uploaded file";
|
||||
else
|
||||
@ -85,7 +91,4 @@ fi
|
||||
|
||||
kill -9 $CAPT_PID
|
||||
|
||||
rm small-upload-testfile
|
||||
rm big-upload-testfile
|
||||
rm multipart-upload-testfile
|
||||
rm big-download-testfile-ipv6
|
||||
rm -rf $TMP_DIR
|
||||
|
Loading…
Reference in New Issue
Block a user