2019-05-24 17:51:27 +01:00
|
|
|
#!/usr/bin/env bash
|
2019-01-08 15:24:15 +00:00
|
|
|
set -ueo pipefail
|
2019-02-06 12:47:00 +00:00
|
|
|
set +x
|
2019-01-08 15:24:15 +00:00
|
|
|
|
|
|
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
# setup tmpdir for testfiles and cleanup
|
|
|
|
TMP=$(mktemp -d -t tmp.XXXXXXXXXX)
|
|
|
|
cleanup(){
|
|
|
|
rm -rf "$TMP"
|
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2020-04-17 10:20:55 +01:00
|
|
|
echo "Running test-sim"
|
2022-09-16 10:12:06 +01:00
|
|
|
make -C "$SCRIPTDIR"/../../.. install-sim
|
2020-04-17 10:20:55 +01:00
|
|
|
|
|
|
|
echo "Overriding default max segment size to 6MiB"
|
|
|
|
GOBIN=$TMP go install -v -ldflags "-X 'storj.io/uplink.maxSegmentSize=6MiB'" storj.io/storj/cmd/uplink
|
|
|
|
|
2020-12-15 17:58:54 +00:00
|
|
|
# use modified version of uplink
|
2020-04-17 10:20:55 +01:00
|
|
|
export PATH=$TMP:$PATH
|
|
|
|
|
2019-02-06 12:47:00 +00:00
|
|
|
export STORJ_NETWORK_DIR=$TMP
|
2019-01-08 15:24:15 +00:00
|
|
|
|
2019-04-22 14:45:53 +01:00
|
|
|
STORJ_NETWORK_HOST4=${STORJ_NETWORK_HOST4:-127.0.0.1}
|
2019-05-14 16:13:18 +01:00
|
|
|
STORJ_SIM_POSTGRES=${STORJ_SIM_POSTGRES:-""}
|
2019-04-22 14:45:53 +01:00
|
|
|
|
2023-08-03 14:40:44 +01:00
|
|
|
# TODO remove when metainfo.server-side-copy-duplicate-metadata will be dropped
|
|
|
|
export STORJ_METAINFO_SERVER_SIDE_COPY_DUPLICATE_METADATA=true
|
|
|
|
|
2019-01-08 15:24:15 +00:00
|
|
|
# setup the network
|
2019-05-14 16:13:18 +01:00
|
|
|
# if postgres connection string is set as STORJ_SIM_POSTGRES then use that for testing
|
|
|
|
if [ -z ${STORJ_SIM_POSTGRES} ]; then
|
2019-12-20 17:01:46 +00:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network setup
|
2019-05-14 16:13:18 +01:00
|
|
|
else
|
2019-12-20 17:01:46 +00:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network --postgres=$STORJ_SIM_POSTGRES setup
|
2019-05-14 16:13:18 +01:00
|
|
|
fi
|
2019-01-08 15:24:15 +00:00
|
|
|
|
2021-08-31 17:58:01 +01:00
|
|
|
# run tests
|
2019-12-20 17:01:46 +00:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-uplink.sh
|
2020-01-17 10:57:38 +00:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-uplink-share.sh
|
2020-06-15 11:54:42 +01:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-billing.sh
|
2021-02-16 15:36:09 +00:00
|
|
|
|
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-uplink-rs-upload.sh
|
|
|
|
# change RS values and try download
|
|
|
|
sed -i 's@# metainfo.rs: 4/6/8/10-256 B@metainfo.rs: 2/3/6/8-256 B@g' $(storj-sim network env SATELLITE_0_DIR)/config.yaml
|
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-uplink-rs-download.sh
|
|
|
|
|
2019-12-20 17:01:46 +00:00
|
|
|
storj-sim -x --satellites 1 --host $STORJ_NETWORK_HOST4 network destroy
|
2019-01-08 15:24:15 +00:00
|
|
|
|
2019-02-06 12:47:00 +00:00
|
|
|
# setup the network with ipv6
|
2019-04-22 14:45:53 +01:00
|
|
|
#storj-sim -x --host "::1" network setup
|
2019-02-06 12:47:00 +00:00
|
|
|
# aws-cli doesn't support gateway with ipv6 address, so change it to use localhost
|
2019-04-22 14:45:53 +01:00
|
|
|
#find "$STORJ_NETWORK_DIR"/gateway -type f -name config.yaml -exec sed -i 's/server.address: "\[::1\]/server.address: "127.0.0.1/' '{}' +
|
2019-02-06 12:47:00 +00:00
|
|
|
# run aws-cli tests using ipv6
|
2019-04-22 14:45:53 +01:00
|
|
|
#storj-sim -x --host "::1" network test bash "$SCRIPTDIR"/test-sim-aws.sh
|
|
|
|
#storj-sim -x network destroy
|