Test captplanet with travis (#226)
* test captplanet in travis * add comparison between uploaded and downloaded file * test inline and remote files * move captplanet testing to bash script
This commit is contained in:
parent
d396eb6be9
commit
f80ddf9358
@ -17,3 +17,4 @@ script:
|
||||
- go list -f '{{if len .TestGoFiles}}"go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"{{end}}' ./... | xargs -L 1 sh -c
|
||||
- gover
|
||||
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
|
||||
- make test-captplanet
|
||||
|
4
Makefile
4
Makefile
@ -71,6 +71,10 @@ run-hc:
|
||||
-e OVERLAY_PORT=7070 \
|
||||
hc
|
||||
|
||||
test-captplanet:
|
||||
@echo "Running ${@}"
|
||||
@./scripts/test-captplanet.sh
|
||||
|
||||
clean-local:
|
||||
# cleanup heavy client
|
||||
docker stop hc || true
|
||||
|
42
scripts/test-captplanet.sh
Executable file
42
scripts/test-captplanet.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
go install -v storj.io/storj/cmd/captplanet
|
||||
|
||||
captplanet setup
|
||||
captplanet run &
|
||||
CAPT_PID=$!
|
||||
|
||||
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
|
||||
aws configure set default.s3.multipart_threshold 1TB
|
||||
|
||||
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)
|
||||
|
||||
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/ 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
|
||||
|
||||
if cmp ./small-upload-testfile ./small-download-testfile
|
||||
then
|
||||
echo "Downloaded file matches uploaded file";
|
||||
else
|
||||
echo "Downloaded file does not match uploaded file";
|
||||
kill -9 $CAPT_PID
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if cmp ./big-upload-testfile ./big-download-testfile
|
||||
then
|
||||
echo "Downloaded file matches uploaded file";
|
||||
else
|
||||
echo "Downloaded file does not match uploaded file";
|
||||
kill -9 $CAPT_PID
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
kill -9 $CAPT_PID
|
||||
|
@ -11,4 +11,8 @@ mv $HOME/gopath{-staging,}
|
||||
export TRAVIS_BUILD_DIR=$HOME/gopath/src/storj.io/storj
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
|
||||
virtualenv my_py3 --python=/usr/bin/python3.4
|
||||
source my_py3/bin/activate
|
||||
pip install --upgrade awscli
|
||||
|
||||
set +x
|
||||
|
Loading…
Reference in New Issue
Block a user