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 )"
|
|
|
|
|
2019-10-11 15:30:06 +01:00
|
|
|
echo "Running test-sim"
|
2019-03-20 14:58:07 +00:00
|
|
|
make -C "$SCRIPTDIR"/.. install-sim
|
2019-01-08 15:24:15 +00:00
|
|
|
|
|
|
|
# setup tmpdir for testfiles and cleanup
|
|
|
|
TMP=$(mktemp -d -t tmp.XXXXXXXXXX)
|
|
|
|
cleanup(){
|
|
|
|
rm -rf "$TMP"
|
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
storj-sim -x --satellites 2 --host $STORJ_NETWORK_HOST4 network setup
|
|
|
|
else
|
|
|
|
storj-sim -x --satellites 2 --host $STORJ_NETWORK_HOST4 network --postgres=$STORJ_SIM_POSTGRES setup
|
|
|
|
fi
|
2019-01-08 15:24:15 +00:00
|
|
|
|
2019-11-11 18:58:08 +00:00
|
|
|
# explicitly set all the satellites and storagenodes to use mixed grpc and drpc
|
|
|
|
(
|
|
|
|
eval "$( storj-sim --satellites 2 network env )"
|
|
|
|
|
|
|
|
N=0
|
|
|
|
DIR="SATELLITE_${N}_DIR"
|
|
|
|
while [ -n "${!DIR:-""}" ]; do
|
|
|
|
[ $((N%2)) -eq 0 ] && KIND=drpc || KIND=grpc
|
|
|
|
BIN="$(which satellite-${KIND})"
|
|
|
|
( set -x; cp "${BIN}" "${!DIR}/satellite" )
|
|
|
|
let N=N+1
|
|
|
|
DIR="SATELLITE_${N}_DIR"
|
|
|
|
done
|
|
|
|
|
|
|
|
N=0
|
|
|
|
DIR="STORAGENODE_${N}_DIR"
|
|
|
|
while [ -n "${!DIR:-""}" ]; do
|
|
|
|
[ $((N%2)) -eq 0 ] && KIND=drpc || KIND=grpc
|
|
|
|
BIN="$(which storagenode-${KIND})"
|
|
|
|
( set -x; cp "${BIN}" "${!DIR}/storagenode" )
|
|
|
|
let N=N+1
|
|
|
|
DIR="STORAGENODE_${N}_DIR"
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2019-11-06 13:53:38 +00:00
|
|
|
# set the segment size lower to make test run faster
|
|
|
|
echo client.segment-size: "6 MiB" >> `storj-sim network env GATEWAY_0_DIR`/config.yaml
|
|
|
|
|
2019-01-08 15:24:15 +00:00
|
|
|
# run aws-cli tests
|
2019-05-09 15:39:43 +01:00
|
|
|
storj-sim -x --satellites 2 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-sim-aws.sh
|
|
|
|
storj-sim -x --satellites 2 --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-uplink.sh
|
|
|
|
storj-sim -x --satellites 2 --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
|