scripts/test-sim-backwards: usability improvements (#2816)

* + add git worktree cleanup
+ specify commit in git worktree add

* fail backwards compatibility test if no postgres

* fix typo

* rm dir after worktree rm
This commit is contained in:
Bryan White 2019-08-19 21:13:38 +02:00 committed by Jess G
parent d83a965139
commit 863675605a

View File

@ -5,6 +5,8 @@ set +x
TMP=$(mktemp -d -t tmp.XXXXXXXXXX)
export STORJ_NETWORK_DIR=$TMP
cleanup(){
git worktree remove -f "$RELEASE_DIR"
git worktree remove -f "$BRANCH_DIR"
rm -rf "$STORJ_NETWORK_DIR"
echo "cleaned up test successfully"
}
@ -15,7 +17,7 @@ RELEASE_DIR="$STORJ_NETWORK_DIR/release"
# setup two different directories containing the code for the latest release tag
# and for the current branch code
git worktree add -f "$BRANCH_DIR"
git worktree add -f "$BRANCH_DIR" HEAD
latestReleaseTag=$(git describe --tags `git rev-list --tags --max-count=1`)
latestReleaseCommit=$(git rev-list -n 1 "$latestReleaseTag")
@ -31,13 +33,14 @@ make -C "$RELEASE_DIR" install-sim
STORJ_NETWORK_HOST4=${STORJ_NETWORK_HOST4:-127.0.0.1}
STORJ_SIM_POSTGRES=${STORJ_SIM_POSTGRES:-""}
# setup the network
if [ -z ${STORJ_SIM_POSTGRES} ]; then
storj-sim -x --host $STORJ_NETWORK_HOST4 network setup
else
storj-sim -x --host $STORJ_NETWORK_HOST4 network --postgres=$STORJ_SIM_POSTGRES setup
echo "Postgres is required for the satellite DB. Exiting."
exit 1
fi
# setup the network
storj-sim -x --host $STORJ_NETWORK_HOST4 network --postgres=$STORJ_SIM_POSTGRES setup
# run upload part of backward compatibility tests from the lastest release branch
storj-sim -x --host $STORJ_NETWORK_HOST4 network test bash "$SCRIPTDIR"/test-backwards.sh upload