Add uplink tests (#1310)

* initial wireup of test script

* making some progress

* working on getting gateway config to work

* get script working for testing uplink

* removes unnecessary stuff

* more removal of unnecessary change

* remove unnecessary pointerdb set in setup

* fix dest dir in test-aws script
This commit is contained in:
Dylan Lott 2019-02-13 14:44:36 -07:00 committed by GitHub
parent b53f9896d3
commit 6d7fe7c7d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 1 deletions

View File

@ -9,7 +9,7 @@ cleanup(){
trap cleanup EXIT
SRC_DIR=$TMPDIR/source
DST_DIR=$(mktemp -d -t tmp.XXXXXXXXXX)
DST_DIR=$TMPDIR/dst
mkdir -p $SRC_DIR $DST_DIR
aws configure set aws_access_key_id $GATEWAY_0_ACCESS_KEY

View File

@ -20,6 +20,7 @@ storj-sim -x network setup
# run aws-cli tests
storj-sim -x network test bash $SCRIPTDIR/test-sim-aws.sh
storj-sim -x network test bash $SCRIPTDIR/test-uplink.sh
storj-sim -x network destroy
# setup the network with ipv6

60
scripts/test-uplink.sh Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -ueo pipefail
TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX)
cleanup(){
rm -rf "$TMPDIR"
echo "cleaned up test successfully"
}
trap cleanup EXIT
BUCKET=bucket-123
SRC_DIR=$TMPDIR/source
DST_DIR=$TMPDIR/dst
mkdir -p $SRC_DIR $DST_DIR
head -c 1024 </dev/urandom > $SRC_DIR/small-upload-testfile # create 1mb file of random bytes (inline)
head -c 5120 </dev/urandom > $SRC_DIR/big-upload-testfile # create 5mb file of random bytes (remote)
head -c 5 </dev/urandom > $SRC_DIR/multipart-upload-testfile # create 5kb file of random bytes (remote)
uplink --config-dir $GATEWAY_0_DIR mb sj://$BUCKET/
uplink --config-dir $GATEWAY_0_DIR cp $SRC_DIR/small-upload-testfile sj://$BUCKET/
uplink --config-dir $GATEWAY_0_DIR cp $SRC_DIR/big-upload-testfile sj://$BUCKET/
uplink --config-dir $GATEWAY_0_DIR cp $SRC_DIR/multipart-upload-testfile sj://$BUCKET/
uplink --config-dir $GATEWAY_0_DIR cp sj://$BUCKET/small-upload-testfile $DST_DIR
uplink --config-dir $GATEWAY_0_DIR cp sj://$BUCKET/big-upload-testfile $DST_DIR
uplink --config-dir $GATEWAY_0_DIR cp sj://$BUCKET/multipart-upload-testfile $DST_DIR
uplink --config-dir $GATEWAY_0_DIR rm sj://$BUCKET/small-upload-testfile
uplink --config-dir $GATEWAY_0_DIR rm sj://$BUCKET/big-upload-testfile
uplink --config-dir $GATEWAY_0_DIR rm sj://$BUCKET/multipart-upload-testfile
uplink --config-dir $GATEWAY_0_DIR ls sj://$BUCKET
uplink --config-dir $GATEWAY_0_DIR rb sj://$BUCKET
if cmp $SRC_DIR/small-upload-testfile $DST_DIR/small-upload-testfile
then
echo "small upload testfile matches uploaded file"
else
echo "small upload testfile does not match uploaded file"
fi
if cmp $SRC_DIR/big-upload-testfile $DST_DIR/big-upload-testfile
then
echo "big upload testfile matches uploaded file"
else
echo "big upload testfile does not match uploaded file"
fi
if cmp $SRC_DIR/multipart-upload-testfile $DST_DIR/multipart-upload-testfile
then
echo "multipart upload testfile matches uploaded file"
else
echo "multipart upload testfile does not match uploaded file"
fi